public IActionResult Put(int id, [FromBody] ActivityTypeModel updatedactivityType) { var activityType = _activityTypeService.Update(updatedactivityType.ToDomainModel()); if (activityType == null) { return(NotFound()); } return(Ok(activityType.ToApiModel())); }
public IActionResult Post([FromBody] ActivityTypeModel newActivityType) { try { _activityTypeService.Add(newActivityType.ToDomainModel()); } catch (System.Exception ex) { ModelState.AddModelError("AddActivityType", ex.GetBaseException().Message); return(BadRequest(ModelState)); } return(CreatedAtAction("Get", new { Id = newActivityType.Id }, newActivityType)); }