public JsonResult GetRawMaterialCodeDropDown(string q) { List <RawMaterialDto> list = new List <RawMaterialDto>(); using (var service = new RawMaterialService()) { list = service.GetAll(); } return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { List<RawMaterial> rawMaterials = new List<RawMaterial>(); using (RawMaterialService svc = new RawMaterialService()) { var dtos = svc.GetAll(); rawMaterials.AddRange(Mapper.Map<List<RawMaterialDto>, List<RawMaterial>>(dtos)); } ViewBag.RawMaterialsList = rawMaterials; return View(); }
public JsonResult GetRawMaterialList() { List <RawMaterial> rawMaterials = new List <RawMaterial>(); using (RawMaterialService svc = new RawMaterialService()) { // TODO: Uncomment line below and delete call to GetAll once PlantId set properly //var dtos = svc.GetAllByPlantId(LocalCurrentPlantId); var dtos = svc.GetAll(); rawMaterials.AddRange(Mapper.Map <List <RawMaterialDto>, List <RawMaterial> >(dtos)); } return(Json(rawMaterials, JsonRequestBehavior.AllowGet)); }
public JsonResult GetCodeDropDown(string id = "") { List <RawMaterialReceivedDto> list = new List <RawMaterialReceivedDto>(); RawMaterialDto rawMaterialDto = new RawMaterialDto(); if (id != "") { using (var service = new RawMaterialService()) { rawMaterialDto = service.GetAll().Where(q => q.Code == id).ToList().FirstOrDefault(); } using (var service = new RawMaterialReceivedService()) { list = service.GetAll().Where(q => q.RawMaterialId == rawMaterialDto.Id).ToList(); } } return(Json(list, JsonRequestBehavior.AllowGet)); }