public void AddOrUpdate(ICompanyModel model) { try { using (var ctx = new DBProjectEntities()) { var newObject = ctx.Firmy.Find(model.Id); if (newObject == null) { newObject = Mapper.ModelMapper.Mapper.Map <Firmy>(model); ctx.Firmy.Add(newObject); } else { newObject.nazwa_firmy = newObject.nazwa_firmy; newObject.NIP = newObject.NIP; newObject.nr_telefonu = newObject.nr_telefonu; } ctx.SaveChanges(); } } catch (Exception ex) { Logger.Log(ex.Message); } }
public AddEditPresenter(CompanyPresenter parent, ICompanyModel model, ViewMode mode) { this.model = model; departments = model.GetDepartments(); employees = model.GetEmployees(); this.mode = mode; this.parentPresenter = parent; this.editView = new AddEditForm(this); editView.LoadForm(); }
public AddEditPresenter(CompanyPresenter parent, ICompanyModel model, ViewMode mode, Empoyee employee) { this.model = model; departments = model.GetDepartments(); employees = model.GetEmployees(); this.editedEmployee = employee; this.originalDepartment = employee.DepartmentID; this.mode = mode; this.parentPresenter = parent; this.editView = new AddEditForm(this); editView.LoadForm(editedEmployee); }
public bool Remove(ICompanyModel model) { return(Remove(model.Id)); }
public CompanyPresenter(ICompanyView view, ICompanyModel model) { this.view = view; this.model = model; SetStructure(); }