public async Task <IHttpActionResult> Post([FromBody] MeetingLocationDtoModel location) { if (location == null) { return(BadRequest("Required data was not supplied.")); } if (await Exists(location.Description)) { return(Conflict()); } var record = Mapper.Map <MeetingLocationModel>(location); db.MeetingLocations.Add(record); return(await SaveChanges(record, ActionType.Post)); }
public async Task <IHttpActionResult> Put(int id, [FromBody] MeetingLocationDtoModel location) { if (location == null) { return(BadRequest("Required data was not supplied.")); } if (!await Exists(id)) { return(NotFound()); } var record = await db.MeetingLocations.FindAsync(id); if (location.Description != null && record.Description != location.Description) { record.Description = location.Description; } return(await SaveChanges(record, ActionType.Put)); }