//UpdateLaudatory
        public static void UpdateLaudatory(this Laudatory laudatory, LaudatoryViewModel laudatoryViewModel)
        {
            laudatory.ID          = laudatoryViewModel.ID;
            laudatory.Name        = laudatoryViewModel.Name;
            laudatory.Class       = laudatoryViewModel.Class;
            laudatory.Note        = laudatoryViewModel.Note;
            laudatory.Appellation = laudatoryViewModel.Appellation;
            laudatory.CountBook   = laudatoryViewModel.CountBook;

            laudatory.CreatedDate = laudatoryViewModel.CreatedDate;
            laudatory.UpdateDate  = laudatoryViewModel.UpdateDate;
            laudatory.CreatedBy   = laudatoryViewModel.CreatedBy;
            laudatory.UpdateBy    = laudatoryViewModel.UpdateBy;
            laudatory.Status      = laudatoryViewModel.Status;
        }
Esempio n. 2
0
        public HttpResponseMessage Create(HttpRequestMessage request, LaudatoryViewModel controPanelVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    Laudatory newLaudatory = new Laudatory();
                    newLaudatory.UpdateLaudatory(controPanelVM);
                    newLaudatory.CreatedDate = DateTime.Now;
                    newLaudatory.CreatedBy = User.Identity.Name;
                    var page = _laudatoryService.Add(newLaudatory);
                    _laudatoryService.Save();
                    response = request.CreateResponse(HttpStatusCode.Created, page);
                }
                return response;
            }));
        }
 public void Update(Laudatory Laudatory)
 {
     _laudatoryRepository.Update(Laudatory);
 }
 public Laudatory Add(Laudatory Laudatory)
 {
     return(_laudatoryRepository.Add(Laudatory));
 }