public void EditDepotAssigned([FromBody] DrugUnitsApiModel drugUnitModel) { if (ModelState.IsValid) { var drugUnitDto = _mapper.AutoMapper.Map <DrugUnitsApiModel, DrugUnitDto>(drugUnitModel); _drugUnitsService.Save(drugUnitDto); } }
public ActionResult Edit([Bind(Include = "DrugUnitId,PickNumber,DrugTypeId,DepotId")] DrugUnitsViewModel drugUnitModel) { if (ModelState.IsValid) { var drugUnitDto = _mapper.AutoMapper.Map <DrugUnitsViewModel, DrugUnitDto>(drugUnitModel); _drugUnitsService.Save(drugUnitDto); return(RedirectToAction("Index")); } LookupDto lookup; ViewBag.DepotId = new SelectList(_depotsService.GetDepotLookup(), nameof(lookup.Key), nameof(lookup.Value), drugUnitModel.DepotId); return(View(drugUnitModel)); }