public ActionResult Save(string id, int collectorId) { //List<int> ls = new List<int>(); try { List <CollectorLocationViewModel> vm = new List <CollectorLocationViewModel>(); string[] intre = id.Split(','); foreach (var item in intre) { CollectorLocationViewModel single = new CollectorLocationViewModel(); single.LocationId = Convert.ToInt32(item); vm.Add(single); } var message = cl.saveCollectionLocation(vm, collectorId); return(Json(message, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(e, JsonRequestBehavior.AllowGet)); } }
public ActionResult _CollectorVsLocationList(string collector, string location, int pageNo = 1, int pageSize = 10) { CollectorLocationViewModel customerViewModel = new CollectorLocationViewModel(); var customerList = cl.getCollectorLocationList(collector, location, pageNo, pageSize); customerViewModel.collectorLocatonList = new StaticPagedList <CollectorLocationViewModel>(customerList, pageNo, pageSize, (customerList.Count == 0) ? 0 : customerList.FirstOrDefault().TotalCount); return(PartialView(customerViewModel)); }
// GET: CollectorLocationMap public ActionResult CollectorLocationMapCreate(int?id) { CollectorLocationViewModel collectorLocation = new CollectorLocationViewModel(); if (id != null) { collectorLocation = cl.singleCollectorLocation(id); } return(PartialView(collectorLocation)); }
public ActionResult Index(CollectorLocationViewModel vm) { if (vm.Id != 0) { var message = cl.EditCollectionLocation(vm, Convert.ToInt32(vm.CollectorId)); return(Json(message, JsonRequestBehavior.AllowGet)); } else { return(RedirectToAction("Save", new { @id = vm.locationNames, @collectorid = vm.CollectorId })); } }
//public ActionResult CollectorLocationMapCreateSave(CollectorLocationViewModel collectorLocationViewModel) //{ // try // { // string[] locationIdList = collectorLocationViewModel.locationNames.Split(','); // var message = cl.saveCollectionLocation(collectorLocationViewModel, locationIdList); // return Json(message, JsonRequestBehavior.AllowGet); // } // catch(Exception e) // { // return Json(e, JsonRequestBehavior.AllowGet); // } //} public ActionResult CollectorVsLocationList() { try { CollectorLocationViewModel customerViewModel = new CollectorLocationViewModel(); var customerList = cl.getCollectorLocationList(null, null, 1, 10); customerViewModel.collectorLocatonList = new StaticPagedList <CollectorLocationViewModel>(customerList, 1, 10, (customerList.Count == 0) ? 0 : customerList.FirstOrDefault().TotalCount); //foreach (var item in customerList) //{ // customerViewModel.customerViewModelList.Add(item); //} return(PartialView(customerViewModel)); } catch (Exception ex) { throw ex; } }
public ReturnBaseMessageModel EditCollectionLocation(CollectorLocationViewModel singleCollector, int collectorId) { var singlecollectorLocations = uow.Repository <LocationVsCollector>().FindBy(x => x.Id == singleCollector.Id).SingleOrDefault(); singlecollectorLocations.LocationId = singleCollector.LocationId; singlecollectorLocations.CollectorId = collectorId; singlecollectorLocations.Postedby = Global.UserId; singlecollectorLocations.PostedOn = DateTime.Now; uow.Repository <LocationVsCollector>().Edit(singlecollectorLocations); returnMessage.Msg = "Edited Successfully"; returnMessage.Success = true; uow.Commit(); return(returnMessage); //if (collectorLocationViewModel.Id != 0) //{ //} }