public IHttpActionResult AddStore(StoreDto store) { StoreManager storeManager = new StoreManager(); string message; if (storeManager.IsValid(MethodTypes.Post, store, out message)) { var newStore = storeManager.AddStore(store, out message); if (newStore != null) { return(Ok(newStore)); } } return(BadRequest(message)); }
public void AddStore(string Name, Guid Company, string Address, string City, string Zip, string Country, string Longitude, string Latitude) { if (ValidInput(Name, Company, Address, City, Zip, Country)) { store newStore = new store(); newStore.Name = Name; newStore.CompanyId = CompanyManager.getcompany(Company).Id; newStore.Address = Address; newStore.City = City; newStore.Zip = Zip; newStore.Country = Country; List <double?> location = getLocation(Address, City, Zip, Country); newStore.Longitude = location[1].ToString(); newStore.Latitude = location[0].ToString(); newStore.Id = Guid.NewGuid(); StoreManager.AddStore(newStore); } Response.Redirect(Request.UrlReferrer.ToString()); }