Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 public IHttpActionResult PostActivityType(ActivityType activityType)
 {
     activityTypeService.Add(activityType);
     return(Ok());
 }