public LOCATIONS CreateLocation(LocationsViewModel loc) { return(new LOCATIONS { LOCATION_ID = loc.LocationId, ADDRESS1 = loc.Address1, ADDRESS2 = loc.Address2, CITY = loc.City, STATE = loc.State, ZIP_CODE = loc.ZipCode }); }
public int AddLocationInfo(LocationsViewModel location) { try { var loc = ModelFactory.CreateLocation(location); db.LOCATIONS.Add(loc); SaveAll(); return(loc.LOCATION_ID); } catch (Exception ex) { Console.WriteLine(ex); throw; } }
public bool UpdateAddress(LocationsViewModel location) { db.Entry(GetLocationById(location.LocationId)).CurrentValues.SetValues(ModelFactory.CreateLocation(location)); return(SaveAll()); }