public bool DeleteTransporter(Transporter transporter) { if (transporter == null) return false; _unitOfWork.TransporterRepository.Delete(transporter); _unitOfWork.Save(); return true; }
public ActionResult Create(Transporter transporter) { if (!ModelState.IsValid) { transportService.AddTransporter(transporter); } //return RedirectToAction("Edit"); //return View(transporter); return RedirectToAction("Index"); }
public bool EditTransporter(Transporter transporter) { _unitOfWork.TransporterRepository.Edit(transporter); _unitOfWork.Save(); return true; }
public bool AddTransporter(Transporter transporter) { _unitOfWork.TransporterRepository.Add(transporter); _unitOfWork.Save(); return true; }
public TransporterPOCO ToPOCO(Transporter tm) { TransporterPOCO transporterPoco = new TransporterPOCO(); transporterPoco.TransporterID = tm.TransporterID; transporterPoco.Name = tm.Name; /* transporterPoco.Region = _adminUnitService.FindById(tm.Region).Name; transporterPoco.Zone = _adminUnitService.FindById(tm.Zone).Name; transporterPoco.Woreda = _adminUnitService.FindById(tm.Woreda).Name; */ transporterPoco.Region = tm.Region.ToString(); transporterPoco.Zone = tm.Zone.ToString(); transporterPoco.Woreda = tm.Woreda.ToString(); transporterPoco.SubCity = tm.SubCity; transporterPoco.Kebele = tm.Kebele; transporterPoco.HouseNo = tm.HouseNo; transporterPoco.TelephoneNo = tm.TelephoneNo; transporterPoco.MobileNo = tm.MobileNo; transporterPoco.Ownership = tm.Ownership; transporterPoco.VehicleCount = tm.VehicleCount; transporterPoco.LiftCapacityFrom = tm.LiftCapacityFrom; transporterPoco.Capital = tm.Capital; transporterPoco.EmployeeCountMale = tm.EmployeeCountMale; transporterPoco.EmployeeCountFemale = tm.EmployeeCountFemale; transporterPoco.OwnerName = tm.OwnerName; transporterPoco.OwnerMobile = tm.OwnerMobile; transporterPoco.ManagerName = tm.ManagerName; transporterPoco.ManagerMobile = tm.ManagerMobile; transporterPoco.OwnedByDRMFSS = tm.OwnedByDRMFSS; //TransporterPOCO tp= new TransporterPOCO{ // TransporterID=tm.TransporterID, // Name=tm.Name, // Region= _adminUnitService.FindById(tm.Region).Name, // Zone=_adminUnitService.FindById(tm.Zone).Name, // Woreda=_adminUnitService.FindById(tm.Woreda).Name, // SubCity = tm.SubCity, // Kebele=tm.Kebele, // HouseNo=tm.HouseNo, // TelephoneNo=tm.TelephoneNo, // MobileNo = tm.MobileNo, // Ownership=tm.Ownership,VehicleCount=tm.VehicleCount,LiftCapacityFrom=tm.LiftCapacityFrom, // Capital=tm.Capital, EmployeeCountMale=tm.EmployeeCountMale,EmployeeCountFemale=tm.EmployeeCountFemale, // OwnerName=tm.OwnerName, OwnerMobile=tm.OwnerMobile ,ManagerName=tm.ManagerName, // ManagerMobile=tm.ManagerMobile // //, ExperienceFrom=tm.ExperienceFrom ,ExperienceTo=tm.ExperienceTo // }; return transporterPoco; }
public ActionResult EditPartial(int id = 0) { ViewBag.Regions = _adminUnitService.FindBy(t => t.AdminUnitTypeID == 2); //ViewBag.Regions = new SelectList(_adminUnitService.FindBy(t => t.AdminUnitTypeID == 2), "AdminUnitID", "Name"); Transporter transporter; if (id == 0) { transporter = new Transporter(); } else { transporter = transportService.FindById(id); } if (transporter == null) { return HttpNotFound(); } return View(transporter); }
public ActionResult EditPartial(Transporter transporter) { // return Json(new[] { item }.ToDataSourceResult(request, ModelState)); if (ModelState.IsValid) { if (transporter.TransporterID == 0) { transportService.AddTransporter(transporter); } else { transportService.EditTransporter(transporter); } return Json("{}", JsonRequestBehavior.AllowGet); } return View(transporter); }
public ActionResult EditingInline_Update([DataSourceRequest] DataSourceRequest request, Transporter transporter) { transportService.EditTransporter(transporter); return Json(ModelState.ToDataSourceResult(), JsonRequestBehavior.AllowGet); }
public ActionResult EditingInline_Destroy([DataSourceRequest] DataSourceRequest request, Transporter transporter) { if (transporter != null) { transportService.DeleteById(transporter.TransporterID); transportService.DeleteTransporter(transporter); } return Json(ModelState.ToDataSourceResult()); }
public ActionResult EditingInline_Create([DataSourceRequest] DataSourceRequest request, Transporter transporter) { if (transporter != null && ModelState.IsValid) { transportService.AddTransporter(transporter); } return Json(new[] { transporter }.ToDataSourceResult(request, ModelState)); }
public ActionResult Edit(Transporter transporter, string strExperienceFrom, string strExperienceTo) { DateTime ExperienceFrom; DateTime ExperienceTo; /* try { ExperienceFrom = DateTime.Parse(strExperienceFrom); ExperienceTo = DateTime.Parse(strExperienceTo); //OpeningDate = DateTime.Parse(Opening); } catch (Exception) { getGregorianDate EthData = new getGregorianDate(); ExperienceFrom = EthData.ReturnGregorianDate(strExperienceFrom); ExperienceTo = EthData.ReturnGregorianDate(strExperienceTo); }*/ if (ModelState.IsValid) { if (transporter.TransporterID == 0) { transportService.AddTransporter(transporter); } else { // transporter.ExperienceFrom = ExperienceFrom; // transporter.ExperienceTo = ExperienceTo; transportService.EditTransporter(transporter); } return RedirectToAction("Index"); } return View(transporter); }
// // GET: /Procurement/Default1/Edit/5 public ActionResult Edit(int id = 0, int ispartial = 0) { Transporter transporter; if (id == 0) { transporter = new Transporter(); } else { ViewBag.Regions = _adminUnitService.FindBy(t => t.AdminUnitTypeID == 2); transporter = transportService.FindById(id); //ViewBag.Regions = new SelectList(_adminUnitService.FindBy(t => t.AdminUnitTypeID == 2), "AdminUnitID", "Name"); //ViewBag.zones = new SelectList(_adminUnitService.FindBy(z => z.AdminUnitTypeID == 3 && z.ParentID == transporter.Region), "AdminUnitID", "Name"); //ViewBag.woredas = new SelectList(_adminUnitService.FindBy(w => w.AdminUnitTypeID == 4 && w.ParentID == transporter.Zone), "AdminUnitID", "Name"); } if (transporter == null) { return HttpNotFound(); } if (ispartial == 1) { return RedirectToAction("EditPartial/" + id); } return View(transporter); }