public IActionResult NewLdpr([FromBody] LdprModel ldpr)
 {
     try
     {
         _unitOfWork.LdprRepository.Insert(ldpr);
         _unitOfWork.Save();
         return(Ok("Message received successfully."));
     }
     catch (System.Exception ex)
     {
         return(BadRequest());
     }
 }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
 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());
            }
        }
Beispiel #9
0
        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);
     }
 }
Beispiel #11
0
        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();
        }
Beispiel #12
0
 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();
 }