public async Task <HttpResponseMessage> AddDish([FromBody] DishViewModel dish) { string userName = RequestContext.Principal.Identity.Name; IdentityUser user = await authContext.FindUserByUserName(userName); dish.AuthorId = user.Id; dish.Archived = false; dish.Published = true; Mapper.CreateMap <DishViewModel, Dish>(); Dish newDish = Mapper.Map <DishViewModel, Dish>(dish); newDish = _dishRepo.AddDishFromViewModel(newDish); Mapper.CreateMap <Dish, DishViewModel>(); DishViewModel newDishVm = Mapper.Map <Dish, DishViewModel>(newDish); return(Request.CreateResponse(HttpStatusCode.OK, newDishVm)); }