public IActionResult NewLdpr([FromBody] LdprModel ldpr) { try { _unitOfWork.LdprRepository.Insert(ldpr); _unitOfWork.Save(); return(Ok("Message received successfully.")); } catch (System.Exception ex) { return(BadRequest()); } }
public void Create(UserCommentDto commentDto) { var userComment = new UserComment { Comment = commentDto.UserComment, MovieID = commentDto.MovieID, UserID = commentDto.UserID, UserName = commentDto.UserName }; uow.CommentsRepository.Create(userComment); uow.Save(); }
public CategoryModel NewCategory([FromBody] CategoryModel category) { try { _unitOfWork.CategoryRepository.Insert(category); _unitOfWork.Save(); return(category); } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public GANModel NewGan([FromBody] GANModel gan) { try { _unitOfWork.GANRepository.Insert(gan); _unitOfWork.Save(); return(gan); } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public IActionResult NewComment(CommentModel comment) { try { _unitOfWork.CommentRepository.Insert(comment); _unitOfWork.Save(); Console.WriteLine("Message sent successfully."); return(Ok()); } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(BadRequest()); } }
public IActionResult New([FromBody] AttachmentModel attachment) { try { _unitOfWork.AttachmentRepository.Insert(attachment); _unitOfWork.Save(); return(Ok(success)); } catch (System.Exception) { return(BadRequest()); throw; } }
public IActionResult New([FromBody] ExpenditureModel expenditure) { try { _unitOfWork.ExpenditureRepository.Insert(expenditure); _unitOfWork.Save(); return(Ok(success)); } catch (System.Exception ex) { return(BadRequest()); throw; } }
public IActionResult NewGrant([FromBody] GrantModel newGrant) { try { _unitOfWork.GrantRepository.Insert(newGrant); foreach (var comment in newGrant.Comments) { _unitOfWork.CommentRepository.Insert(comment); } foreach (var report in newGrant.ReportDates) { _unitOfWork.ReportRepository.Insert(report); } _unitOfWork.Save(); Console.WriteLine("Message returned successfully."); return(Ok("Message received successfully.")); } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(BadRequest()); } }
public void Create(MovieDto movieDto) { Movie currentMovie; if (uow.MovieRepository.GetByName(movieDto.MovieName) == null) { currentMovie = new Movie { MovieName = movieDto.MovieName, UserMovieNote = movieDto.UserMovieNote, MoviePoster = movieDto.MoviePoster }; } else { throw new InvalidOperationException("This movie is exist, check forum!"); } uow.MovieRepository.Create(currentMovie); uow.Save(); }
public PickListModel NewPicklistItem([FromBody] PickListModel list) { try { _unitOfWork.PickListRepository.Insert(list); _unitOfWork.Save(); return(list); } catch (System.Exception ex) { Console.WriteLine(ex.Message); return(null); } }
public void Create(UserDto userdto) { ApplicationUser currentuser; if (uow.UserManager.FindByEmail(userdto.UserLogin) == null) { currentuser = new ApplicationUser { Email = userdto.UserLogin, UserName = userdto.UserName, }; } else { throw new InvalidOperationException("User with this login is exist!"); } uow.UserManager.Create(currentuser, userdto.UserPasswd); uow.UserManager.AddToRole(currentuser.Id, userdto.Role); uow.Save(); }
public void Save() { _uow.Save(); }
// POST api/trainees public void Post([FromBody] Trainee trainee) { _uow.Trainee.InsertOrUpdate(trainee); _uow.Save(); }
// POST api/mentors public void Post([FromBody] Mentor mentor) { _uow.Mentor.InsertOrUpdate(mentor); _uow.Save(); }