public ActionResult Create() { UserPermissionAction("OfficeLocation", RoleAction.create.ToString()); CheckPermission(); OfficeLocationModel officelocation = new CommunicationApp.Models.OfficeLocationModel(); officelocation.CompanyId = Convert.ToInt32(Session["CompanyID"]); return(View(officelocation)); }
// GET: /Customer/Edit/5 public ActionResult EditOfficeLocation(int id) { try { var OfficeLocation = _OfficeLocationService.GetOfficeLocation(id); Mapper.CreateMap <CommunicationApp.Entity.OfficeLocation, CommunicationApp.Models.OfficeLocationModel>(); CommunicationApp.Models.OfficeLocationModel OfficeLocationModel = Mapper.Map <CommunicationApp.Entity.OfficeLocation, CommunicationApp.Models.OfficeLocationModel>(OfficeLocation); return(View(OfficeLocationModel)); } catch { } return(View()); }
// // GET: /OfficeLocation/ public ActionResult Index(string Address, string PhoneNo, string Email) { UserPermissionAction("OfficeLocation", RoleAction.view.ToString()); CheckPermission(); List <OfficeLocationModel> OfficeLocationModelList = new List <OfficeLocationModel>(); try { CustomerModel CustomerModel; var CompanyId = Convert.ToInt32(Session["CompanyID"]) == null ? 0 : Convert.ToInt32(Session["CompanyID"]); Mapper.CreateMap <CommunicationApp.Entity.OfficeLocation, CommunicationApp.Models.OfficeLocationModel>(); var OfficeLocations = _OfficeLocationService.GetOfficeLocations().Where(c => c.CompanyId == CompanyId); //For Address if (!string.IsNullOrEmpty(Address)) { OfficeLocations = OfficeLocations.Where(c => c.OfficeAddress.ToLower().Contains(Address.ToLower())); } //Phone No if (!string.IsNullOrEmpty(PhoneNo)) { OfficeLocations = OfficeLocations.Where(c => c.TelephoneNo.ToLower().Contains(PhoneNo.ToLower())); } //For Email if (!string.IsNullOrEmpty(Email)) { OfficeLocations = OfficeLocations.Where(c => c.Email.ToLower().Contains(Email.ToLower())); } foreach (var OfficeLocation in OfficeLocations) { CommunicationApp.Models.OfficeLocationModel OfficeLocationModel = Mapper.Map <CommunicationApp.Entity.OfficeLocation, CommunicationApp.Models.OfficeLocationModel>(OfficeLocation); OfficeLocationModelList.Add(OfficeLocationModel); } return(View(OfficeLocationModelList)); } catch (Exception ex) { TempData["ShowMessage"] = "error"; TempData["MessageBody"] = ""; ErrorLogging.LogError(ex); return(View()); } return(View(OfficeLocationModelList)); }