public static SelectListItem ToSelectListItem(this BeerTypeDto source) { var result = new SelectListItem(); result.Value = source.Code.ToString(); result.Text = source.Description; return(result); }
public static BeerTypeDto ToBeerTypeDto(this BeerTypeViewModel source) { var result = new BeerTypeDto { Code = source.Code, Description = source.Description }; return(result); }
public void UpdateBeerType(BeerTypeDto beerTypeDto) { //var newType = beerTypeDto.Description; var entityToModify = Context.BeerType.Find(beerTypeDto.Code); entityToModify.Name = beerTypeDto.Description; Context.SaveChanges(); }
public static BeerTypeDto ToBeerTypeDto(this BeerType source) { var result = new BeerTypeDto(); if (source != null) { result = new BeerTypeDto { Code = source.Id, Description = source.Name }; } return(result); }
public static BeerType ToBeerType(this BeerTypeDto source) { if (source == null) { return(null); } var result = new BeerType { Name = source.Description, Id = source.Code }; return(result); }
public void CreateBeerType(string type) { Guid guid; guid = Guid.NewGuid(); BeerTypeDto newBeerTypeDto = new BeerTypeDto { Code = guid, Description = type }; var newBeerType = newBeerTypeDto.ToBeerType(); Context.BeerType.Add(newBeerType); var result = Context.SaveChanges(); }