ASP.NET Core MVC Web application for sharing, rating and reviewing films, adding projections in registered cinemas and reserving tickets
Made as an exam project for IT Career Module 7 "Software Development" by Tsvetilin Tsvetilov, Stoyan Zlatev and Pavlin Marinov
Three-tier architecture
- Code First
- MySql Database
- Entity Framework
- Data Seeding
-
Web APIs
- SendGrid Email sending
- OMDb Film data fetching from IMDb
- Cloudinary Uploading user's images in the cloud
-
Template model converting
- Default service method
public async Task<FilmData> GetAsync(string id) { return await context.FilmDatas.FindAsync(id); }
- Model templated service method
public async Task<TModel> GetAsync<TModel>(string id, Func<FilmData, TModel> mapToModelFunc) { var film = await GetAsync(id); return mapToModelFunc(film); }
- Default service method
- ASP.NET Core 3.0
- Custom Mapper
- Default mapping method
private TToModel MapSimilarProperties<TFromModel, TToModel>(TFromModel fromObject) where TFromModel : class where TToModel : class, new() { TToModel model = new TToModel(); if (fromObject != null) { PropertyInfo[] props = fromObject.GetType().GetProperties(); var modelType = model?.GetType(); foreach (var prop in props) { var modelProperty = modelType?.GetProperty(prop.Name); if (modelProperty?.PropertyType?.Equals(prop.PropertyType) ?? false) { modelProperty.SetValue(model, prop.GetValue(fromObject)); } } } return model; }
- Mapping Entity model to View model example
public ExtendedFilmCardViewModel MapToExtendedFilmCardViewModel(FilmData filmData) { var viewModel = MapSimilarProperties<FilmData, ExtendedFilmCardViewModel>(filmData); if (filmData != null) { viewModel.Id = filmData.FilmId; viewModel.Genres = string.Join(", ", filmData.Genre.Select(a => a.Genre.ToString())); viewModel.Rating = Math.Round(filmData.Film.Rating, 1).ToString(); } return viewModel; }
- Default mapping method
- NUnit tests
- 70% code coverage
- Moq Database mockup