public static int Insert(StaffDto staff) { int id = StaffDao.Insert(staff); staff.UserId = id; allStaffs.Add(staff); allStaffs.OrderBy(n => n.UserId); return(id); }
private void Save() { StaffEntity StaffEntity = new StaffEntity(); StaffEntity.Name = txtName.Text; StaffEntity.Salary = decimal.Parse(Helpers.CurrencyToString(txtSalary.Text).ToString()); StaffEntity.HireDate = DateTime.Parse(dtpHireDate.Value.ToString("dd/MM/yyyy")); StaffEntity.StopDate = DateTime.Parse(dtpStopDate.Value.ToString("dd/MM/yyyy")); StaffEntity.Photo = pic; if (getId != Guid.Empty) { StaffEntity.Id = getId; StaffDao.Update(StaffEntity); } else { StaffEntity.Id = Guid.NewGuid(); StaffDao.Insert(StaffEntity); } }