public bool Update(Client model) { try { var originalModel = _persistenceDbContext.Clients.Single( x => x.ClientId == model.ClientId ); originalModel.Dni = model.Dni; originalModel.Name = model.Name; originalModel.LastName = model.LastName; originalModel.Phone = model.Phone; originalModel.Email = model.Email; originalModel.Sex = model.Sex; originalModel.Address = model.Address; originalModel.UpdatedDate = DateTime.Now; _persistenceDbContext.Update(originalModel); _persistenceDbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(User model) { try { var originalModel = _persistenceDbContext.Users.Single( x => x.UserId == model.UserId ); originalModel.Name = model.Name; originalModel.Phone = model.Phone; originalModel.Email = model.Email; originalModel.UserName = model.UserName; originalModel.Password = model.Password; originalModel.Role = model.Role; originalModel.UpdatedDate = DateTime.Now; _persistenceDbContext.Update(originalModel); _persistenceDbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(Product model) { try { var originalModel = _persistenceDbContext.Products.Single( x => x.ProductId == model.ProductId ); originalModel.Supplier = model.Supplier; originalModel.Name = model.Name; originalModel.ProductCode = model.ProductCode; originalModel.Type = model.Type; originalModel.Quantity = model.Quantity; originalModel.PricePerSale = model.PricePerSale; originalModel.PricePerPurchase = model.PricePerPurchase; originalModel.UpdatedDate = DateTime.Now; _persistenceDbContext.Update(originalModel); _persistenceDbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(Sale model) { try { var originalModel = _persistenceDbContext.Sales.Single( x => x.SaleId == model.SaleId ); originalModel.Product = model.Product; originalModel.User = model.User; originalModel.Client = model.Client; originalModel.ProductId = model.ProductId; originalModel.UserId = model.UserId; originalModel.ClientId = model.ClientId; originalModel.Discount = model.Discount; originalModel.SubTotal = model.SubTotal; originalModel.Total = model.Total; originalModel.SaleDate = model.SaleDate; originalModel.UpdatedDate = DateTime.Now; _persistenceDbContext.Update(originalModel); _persistenceDbContext.SaveChanges(); } catch (Exception) { return(false); } return(true); }
public bool Update(Supplier model) { try { var originalModel = _persistenceDbContext.Suppliers.Single( x => x.SupplierId == model.SupplierId ); originalModel.Dni = model.Dni; originalModel.Name = model.Name; originalModel.Phone = model.Phone; originalModel.Address = model.Address; originalModel.UpdatedDate = DateTime.Now; _persistenceDbContext.Update(originalModel); _persistenceDbContext.SaveChanges(); } catch (Exception) { return false; } return true; }