public ActionResult InsertLocation(LocationDetailModel oLocationInfo) { try { if (ModelState.IsValid) { oCurrentUser = (SysUser)Session["User"]; var existLocation = oDBContext.OfferLocations.FirstOrDefault(t => t.ID == oLocationInfo.Location.ID); if (existLocation == null) { OfferLocation oOfferLocation = oLocationInfo.Location; oOfferLocation.IsActive = true; oOfferLocation.CreatedBy = oCurrentUser.ID; oOfferLocation.CreatedOn = DateTime.Now; oDBContext.OfferLocations.Add(oOfferLocation); oDBContext.SaveChanges(); TempData["SuccessMsg"] = "Data Saved Successfully"; } else { TempData["ErrorMsg"] = "Data already Exists!!!"; } } } catch (Exception ex) { TempData["ErrorMsg"] = "Error Occured Due to " + ExceptionMsg(ex); } return(RedirectToAction("Index")); }
public async Task <OfferLocation> InsertAsync(OfferLocation offerLocation) { try { var content = await HttpHelper.Request(Constants.FACEOFFERS_AUTH_TOKEN, Constants.FACEOFFERS_API_URL, "api/OfferLocations", offerLocation, HttpRequestType.POST); return(await content.ReadAsAsync <OfferLocation>()); } catch (Exception e) { throw; } }
public ActionResult NewLocation() { oCurrentUser = (SysUser)Session["User"]; var newLocation = new OfferLocation(); newLocation.IsActive = false; var LocationInfo = new LocationDetailModel(); LocationInfo.IsNew = true; LocationInfo.Location = newLocation; ViewBag.LocationList = oDBContext.OfferLocations.Select(x => x).ToList().Select(x => new SelectListItem { Value = x.ID.ToString(), Text = x.LocationName.ToString() }); return(PartialView("_locationDetailPartial", LocationInfo)); }
public async Task DeleteAsync(OfferLocation offerLocation) { throw new NotImplementedException(); }