public bool Update(Product model) { try { var origin = _dbContext.Products.Single(r => r.Id == model.Id); origin.NameProduct = model.NameProduct; origin.Price = model.Price; origin.IdProvider = model.IdProvider; origin.Quatity = model.Quatity; origin.Category = model.Category; origin.BrandProduct = model.BrandProduct; _dbContext.Update(origin); _dbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(Client model) { try { var modelOriginal = _dbContext.Clients.Single(e => e.Id == model.Id); modelOriginal.Name = model.Name; modelOriginal.LastName = model.LastName; modelOriginal.Address = model.Address; modelOriginal.Email = model.Email; modelOriginal.Telephone = model.Telephone; modelOriginal.Dni = model.Dni; _dbContext.Update(modelOriginal); _dbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(Provider model) { try { var origin = _dbContext.Providers.Single(r => r.Id == model.Id); origin.LastName = model.LastName; origin.Name = model.Name; origin.NameCompany = model.NameCompany; origin.Telephone = model.Telephone; origin.Address = model.Address; origin.Dni = model.Dni; origin.Email = model.Email; _dbContext.Update(origin); _dbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(Buy model) { try { var modelOriginal = _dbContext.Buys.Single(e => e.Id == model.Id); modelOriginal.TotalBuy = model.TotalBuy; modelOriginal.TotalArticle = model.TotalArticle; modelOriginal.IdUser = model.IdUser; modelOriginal.IdClient = model.IdClient; modelOriginal.DateBuy = model.DateBuy; _dbContext.Update(modelOriginal); _dbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(User model) { try { var origin = _businessLogicDbContext.Users.Single(r => r.Id == model.Id); origin.LastName = model.LastName; origin.Name = model.Name; origin.Password = model.Password; origin.Telephone = model.Telephone; origin.UserName = model.UserName; origin.Email = model.Email; origin.Dni = model.Dni; origin.Authorize = model.Authorize; origin.Address = model.Address; _businessLogicDbContext.Update(origin); _businessLogicDbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }