internal static LocationVm MapToLocationVm(this Location location) { double? nullable1; double? nullable2; double? nullable; LocationVm locationVm = new LocationVm(); if (location.Latitude.CompareTo(0) != 0) { nullable1 = new double?(location.Latitude); } else { nullable = null; nullable1 = nullable; } locationVm.Latitude = nullable1; if (location.Longitude.CompareTo(0) != 0) { nullable2 = new double?(location.Longitude); } else { nullable = null; nullable2 = nullable; } locationVm.Longitude = nullable2; return(locationVm); }
private List <LocationVm> SaveLocationOnFirstSave(OrganizationVm organization) { ICollection <Location> locationsModel = new List <Location>(); LocationVm vm = new LocationVm { Address = organization.ContactInformation }; { locationsModel.Add(vm.ToModel()); } try { this.organizationService.SaveLocations(organization.Id, locationsModel); List <LocationVm> responseModel = new List <LocationVm>(); foreach (Location m in locationsModel) { responseModel.Add(LocationVm.FromModel(m)); } return(responseModel); } catch (Exception e) { emailHelper.SendErrorEmail(e); } return(null); }
// PUT api/organization/5/locations public HttpResponseMessage Put(int id, ICollection <LocationVm> value) { this.OrganizationId = id; if (!this.UserIsAdminOfOrganization) { Request.CreateResponse(HttpStatusCode.Unauthorized); } var model = new Organization(); ICollection <Location> locationsModel = new List <Location>(); foreach (LocationVm vm in value) { locationsModel.Add(vm.ToModel()); } try { this.organizationService.SaveLocations(id, locationsModel); List <LocationVm> responseModel = new List <LocationVm>(); foreach (Location m in locationsModel) { responseModel.Add(LocationVm.FromModel(m)); } return(Request.CreateResponse(HttpStatusCode.Accepted, responseModel)); } catch (Exception e) { emailHelper.SendErrorEmail(e); } return(Request.CreateResponse(HttpStatusCode.BadRequest)); }
// GET: Location public ActionResult Index() { LocationVm locationVm = new LocationVm(); locationVm.Projects = repository.GetProjects(); locationVm.Cities = repository.GetAllCities(); return(View("AddProject", locationVm)); }
public ActionResult AddPhase() { LocationVm locationVm = new LocationVm(); locationVm.Cities = repository.GetAllCities(); locationVm.Projects = repository.GetProjects(); locationVm.Phase = repository.GetPhases(); return(View(locationVm)); }
public ActionResult create_leads() { ViewBag.Message = "Your application description page."; LocationVm locationVm = new LocationVm(); locationVm.Cities = repository.GetAllCities(); locationVm.Projects = repository.GetProjects(); locationVm.Phase = repository.GetPhases(); locationVm.Blocks = repository.GetBlocks(); return(View(locationVm)); }
public LocationVm UpdateLocationGeofence([FromBody] LocationVm location) { return(GetBusinessLayerProxy(User).UpdateLocationGeofence(location)); }
public HttpResponseMessage Get([FromUri] LocationVm param) { var data = db.GetLocations(param.CompCode, param.CentCode, param.LocCode, param.LocName, param.Extra1, param.Extra2, param.Extra3).ToList(); return(Request.CreateResponse(new ResponseData(data))); }