public void UpdateClient(Client client) { var new_client = _context.Client.Find(client.Id); new_client.Name = client.Name; new_client.CreatedAt = client.CreatedAt; _context.Entry(new_client).State = Microsoft.EntityFrameworkCore.EntityState.Modified; try { _context.SaveChanges(); } catch (UpdateException update) { Debug.WriteLine(update.InnerException); } catch (System.Data.Entity.Infrastructure.DbUpdateException excp) { Debug.WriteLine(excp.InnerException); } catch (Exception ex) { Debug.WriteLine(ex.InnerException); } }
public void UpdateProject(Project project, int id) { var new_project = _context.Project.Find(id); new_project.Name = project.Name; new_project.CreatedAt = project.CreatedAt; new_project.Status = project.Status; new_project.ClientId = project.ClientId; _context.Entry(new_project).State = Microsoft.EntityFrameworkCore.EntityState.Modified; try { _context.SaveChanges(); } catch (UpdateException update) { Debug.WriteLine(update.InnerException); } catch (System.Data.Entity.Infrastructure.DbUpdateException excp) { Debug.WriteLine(excp.InnerException); } catch (Exception ex) { Debug.WriteLine(ex.InnerException); } }