public async Task <int> AddAVideoItem(MissionVideoPostDto videoDataObj) { var newVideo = new MissionVideo(); newVideo.Title = videoDataObj.VideoTitle; newVideo.Description = videoDataObj.VideoDescription; newVideo.Category = videoDataObj.VideoCategory; newVideo.PosterPath = videoDataObj.VideoPhotoFilePath; newVideo.VideoPath = videoDataObj.VideoFilePath; newVideo.DateCreated = DateTime.UtcNow; newVideo.Rating = 0; await _context.MissionVideos.AddAsync(newVideo); var numberInserted = _context.SaveChanges(); return(numberInserted); }
public async Task <ActionResult> AddAVideoItem(MissionVideoPostDto videoData) { if (!ModelState.IsValid) { _logger.LogError("In cvideos controller, add video item model not good"); return(BadRequest(ModelState)); } var num = await _videoRepo.AddAVideoItem(videoData); if (num < 1) { _logger.LogError("In cvideos controller, add a video item retuned 0 from repo"); return(BadRequest("The video item was not created.")); } var confirm = _confirm.ConfirmResponse(true, "A Video item was created successfully."); return(Ok(confirm)); }