public int PostBuy(LoadBuyRequest request) { int idBuyResponse; decimal DecimalAmount = Convert.ToDecimal(request.TotalAmount); try { BuysEntity buysEntity = new BuysEntity() { UploadDate = request.UploadDate, TotalAmount = DecimalAmount, IdClient = request.IdClient, IdOrder = request.IdOrder, IdMeLi = request.IdMeLi }; context.BuysEntity.Add(buysEntity); context.SaveChanges(); idBuyResponse = buysEntity.IdBuy; } catch (Exception ex) { Console.WriteLine("BuyDataAccess.PostBuy : ERROR : " + ex.Message); throw; } return(idBuyResponse); }
public int PostClient(LoadClientRequest request) { int idClientResponse; try { var clientEntity = new ClientsEntity() { Name = request.Name, Surname = request.Surname, IdentificationNumber = request.IdentificationNumber, IdTypeIdentification = request.IdTypeIdentification, HomeStreet = request.HomeStreet, HomeHeigth = request.HomeHeigth, HomeDetails = request.HomeDetails, Departament = request.Departament, Region = request.Region, IdPostalCode = request.IdPostalCode, Email = request.Email, Phone = request.Phone, AdicionalInfo = request.AdicionalInfo }; context.ClientsEntity.Add(clientEntity); context.SaveChanges(); idClientResponse = clientEntity.IdClient; } catch (Exception ex) { Console.WriteLine("ClientDataAccess.PostClient : ERROR : " + ex.Message); throw; } return(idClientResponse); }
public void Insert(LoadProductRequest request) { try { ProductsEntity productEntity = new ProductsEntity() { Description = request.Description, Name = request.Name, IdMarca = request.idMarca, Stock = request.Stock, Price = request.Price, IdCategory = request.IdCategory, IdSubCategory = request.IdSubCategory, Recipe = request.Recipe, EAN = request.EAN, ImgCount = request.ImgCount }; context.ProductsEntity.Add(productEntity); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("ProductDataAccess.Insert : ERROR : " + ex.Message); throw; } }
public void Insert(LoadClientRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); ClientsEntity clientEntity = new ClientsEntity() { Name = request.Name, Surname = request.Surname, IdentificationNumber = request.IdentificationNumber, IdTypeIdentification = request.IdTypeIdentification, HomeStreet = request.HomeStreet, HomeHeigth = request.HomeHeigth, IdPostalCode = request.IdPostalCode, Email = request.Email, Phone = request.Phone }; context.ClientsEntity.Add(clientEntity); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("ClientDataAccess.Insert : ERROR : " + ex.Message); throw; } }
public int PostOrder(int newOrder) { int idOrderResponse; try { OrdersEntity orderEntity = new OrdersEntity() { IdTypeOrder = newOrder }; context.OrdersEntity.Add(orderEntity); context.SaveChanges(); idOrderResponse = orderEntity.IdOrder; } catch (Exception ex) { Console.WriteLine("OrderDataAccess.PostOrder : ERROR : " + ex.Message); throw; } return(idOrderResponse); }
public void LoadMarca(LoadMarcaRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); MarcasEntity marcaEntity = new MarcasEntity() { Description = request.Description }; context.MarcasEntity.Add(marcaEntity); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("ProductDataAccess.LoadMarca : ERROR : " + ex.Message); throw; } }
public void LoadSubCategory(LoadSubCategoryRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); SubCategorysEntity subCategoryEntity = new SubCategorysEntity() { Description = request.Description }; context.SubCategorysEntity.Add(subCategoryEntity); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("ProductDataAccess.LoadSubCategory : ERROR : " + ex.Message); throw; } }
public void Insert(LoadRecipeRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); RecipesEntity recipe = new RecipesEntity() { Path = request.Path }; context.RecipesEntity.Add(recipe); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("RecipeDataAccess.Insert : ERROR : " + ex.Message); throw; } }
public void LoadNewsLetter(LoadNewsLetterRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); NewsletterEntity newsletterEntity = new NewsletterEntity() { Email = request.Email, Phone = request.Phone }; context.NewsletterEntity.Add(newsletterEntity); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("ClientDataAccess.LoadNewsLetter : ERROR : " + ex.Message); throw; } }
public void InsertDetail(BuyDetailRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); BuysDetailsEntity buysDetailsEntity = new BuysDetailsEntity() { IdProduct = request.IdProduct, Quantity = request.Quantity, IdBuy = request.IdBuy }; context.BuysDetailsEntity.Add(buysDetailsEntity); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("BuyDataAccess.InsertDetail : ERROR : " + ex.Message); throw; } }
public void Insert(BuyRequest request) { try { MASFARMACIADEVContext context = new MASFARMACIADEVContext(); BuysEntity buysEntity = new BuysEntity() { UploadDate = request.UploadDate, TotalAmount = request.TotalAmount, IdClient = request.IdClient, IdOrder = request.IdOrder }; context.BuysEntity.Add(buysEntity); context.SaveChanges(); } catch (Exception ex) { Console.WriteLine("BuyDataAccess.Insert : ERROR : " + ex.Message); throw; } }