public bool UpdateAccount(RealEstateAccountDto model) { try { var item = _realEstateEntities.Accounts.Find(model.AccountId); item.Email = model.Email; item.FirstName = model.FirstName; item.LastName = model.LastName; item.UserName = model.UserName; item.DepartmentId = model.Department.DepartmentId; _realEstateEntities.SaveChanges(); return(true); } catch (System.Exception) { return(false); } }
public bool CreateAccount(RealEstateAccountDto model) { try { var now = DateTime.Now; var item = new Account { FirstName = model.FirstName, CreateDate = now, Email = model.Email, LastName = model.LastName, DepartmentId = model.Department.DepartmentId, IsDelete = false, }; _realEstateEntities.Accounts.Add(item); return(true); } catch (System.Exception) { return(false); } }
public async Task <IHttpActionResult> UpdateAccount(RealEstateAccountDto arguments) { bool update = _service.UpdateAccount(arguments); return(Ok(RealEstateResponse <bool> .Create(update))); }