public IActionResult AddNewFortifiedWine(FortifiedWine fortifiedWine) { fortifiedWine.FortifiedWineId = 0; var result = _fortifiedWinesRepository.Add(fortifiedWine); return(Created(Request.Path + "/" + result.FortifiedWineId, result)); }
public FortifiedWine Add(FortifiedWine model) { var entity = FortifiedWineEntity.Map(model); var newFortifiedWine = _dataContext.FortifiedWines.Add(entity).Entity; _dataContext.SaveChanges(); return(FortifiedWineEntity.Map(newFortifiedWine)); }
public static FortifiedWineEntity Map(FortifiedWine model) { return(new FortifiedWineEntity { FortifiedWineId = model.FortifiedWineId, Name = model.Name, Abv = model.Abv, Type = model.Type }); }