public void Update(PublicHolidayViewModel Vm) { var data = _mapper.Map <PublicHolidayViewModel, PublicHoliday>(Vm); _publicHolidayRepository.Update(data); SaveChanges(); }
public IHttpActionResult HolidaySave([FromBody] PublicHolidayViewModel model) { model.CreatedBy = User.Identity.GetUserId <long>(); long id = _publicHolidayService.PublicHolidayInsert(model.ToModel()); return(Ok(id.SuccessResponse())); }
public PublicHoliday Add(PublicHolidayViewModel Vm) { var entity = _mapper.Map <PublicHolidayViewModel, PublicHoliday>(Vm); _publicHolidayRepository.Add(entity); SaveChanges(); return(entity); }
public IActionResult Update([FromBody] PublicHolidayViewModel Vm) { if (!ModelState.IsValid) { var allErrors = ModelState.Values.SelectMany(v => v.Errors); return(new BadRequestObjectResult(new GenericResult(false, allErrors))); } else { try { _publicHolidayService.Update(Vm); return(new OkObjectResult(new GenericResult(true, "Update Success"))); } catch (Exception ex) { return(new OkObjectResult(new GenericResult(false, ex.Message))); } } }
public IHttpActionResult HolidayUpdate([FromBody] PublicHolidayViewModel model) { model.UpdatedBy = User.Identity.GetUserId <long>(); _publicHolidayService.PublicHolidayUpdate(model.ToModel()); return(Ok("Updated successfully.".SuccessResponse())); }