public LocationModel CreateLocation(LocationModel location) { var loc = Mapper.Map<LocationModel, Data.Graph.Location>(location); loc = SecurityRepository.SaveOrUpdateLocation(loc); HttpRuntime.Cache.Remove(cacheKey); return Mapper.Map<Data.Graph.Location, LocationModel>(loc); }
public LocationModel UpdateLocation(LocationModel location) { var loc = Mapper.Map<LocationModel, Data.Graph.Location>(location); var existing = SecurityRepository.GetLocation(location.Id); existing.Name = loc.Name; existing.StaticIpAddress = loc.StaticIpAddress; existing.DefaultAccountId = loc.DefaultAccountId; loc = SecurityRepository.SaveOrUpdateLocation(existing); return Mapper.Map<Data.Graph.Location, LocationModel>(loc); }
public ActionResult NewLocation(LocationModel location) { try { if (ModelState.IsValid) { LocationServices.CreateLocation(location); return RedirectToAction("LocationListing"); } } catch (Exception ex) { Logger.Error(ex.ToString()); ModelState.AddModelError(String.Empty, Constants.ServerError); } ViewBag.Action = "NewLocation"; return View("LocationDetail", location); }