public void UpdatePassword(AccountUserDTO user) { var accountUserToUpdate = (from c in db.AccountUsers where c.Id == user.Id select c).FirstOrDefault(); accountUserToUpdate.Password = user.Password; accountUserToUpdate.UpdatedDate = DateTime.Now; db.SubmitChanges(); }
public void Add(AccountUserDTO accountUser) { var element = new AccountUser(accountUser.Name, accountUser.Surname, accountUser.PositionRole, accountUser.PhoneNumber, accountUser.WorkPlace.Id.Value, accountUser.Password); element.Expenses = new EntitySet <Expense>(); db.AccountUsers.InsertOnSubmit(element); db.SubmitChanges(); }
public AccountUserDTO GetCardCode([FromBody] AccountUserDTO value) { Data.ControlCenter.Model.AccountUser u; AccountUserDTO uDTO = new AccountUserDTO(); u = uR.GetById(value.EntityID, false); uDTO = AutoMapper.Mapper.Map <Data.ControlCenter.Model.AccountUser, AccountUserDTO>(u); return(uDTO); }
public void Update(AccountUserDTO user) { var accountUserToUpdate = (from c in db.AccountUsers where c.Id == user.Id select c).FirstOrDefault(); accountUserToUpdate.Name = user.Name; accountUserToUpdate.Surname = user.Surname; accountUserToUpdate.PhoneNumber = user.PhoneNumber; accountUserToUpdate.PositionRole = user.PositionRole; accountUserToUpdate.WorkPlaceId = user.WorkPlace.Id.Value; accountUserToUpdate.UpdatedDate = DateTime.Now; db.SubmitChanges(); }
public HttpResponseMessage UpdateUser(AccountUserDTO user) { try { new UserBL().Update(user); return(Request.CreateResponse(HttpStatusCode.OK, true)); } catch (Exception ex) { LogManager.Instance.Error(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError, false)); } }
public HttpResponseMessage UpdateUserPassowrd(int id, AccountUserDTO user) { try { new UserBL().UpdatePassword(user); LogManager.Instance.Info($"User {user.Name} {user.Surname} (User Id - {user.Id}) - Password updated"); return(Request.CreateResponse(HttpStatusCode.OK, true)); } catch (Exception ex) { LogManager.Instance.Error(ex); return(Request.CreateResponse(HttpStatusCode.InternalServerError, false)); } }
public ResponseDTO CrearRegistro([FromBody] AccountUserDTO value) { var Response = new ResponseDTO(); var IdPersonal = value.EntityID; value.EntityID = 0; Data.ControlCenter.Model.AccountUser u = new Data.ControlCenter.Model.AccountUser(); u = AutoMapper.Mapper.Map <AccountUserDTO, Data.ControlCenter.Model.AccountUser>(value); FuncionLogActualizaciones L = new FuncionLogActualizaciones(); L.LogCreacion(u.Log); uR.SaveOrUpdate(u); if (u.EntityID > 0) { Response.Success = true; Response.Message = "Creado"; switch (value.IdProfile) { case 1: { API.PatientsController ApiUpdate = new PatientsController(); var oData = ApiUpdate.GetID(new PatientsDTO { EntityID = IdPersonal }); oData.IdAccountUser = u.EntityID; ApiUpdate.UpdateRegistro(oData); break; } case 2: { API.MedicController ApiUpdate = new MedicController(); var oData = ApiUpdate.GetID(new MedicDTO { EntityID = IdPersonal }); oData.IdAccountUser = u.EntityID; ApiUpdate.UpdateRegistro(oData); break; } case 3: { break; } } } return(Response); }
public AccountUserDTO Login([FromBody] AccountUserDTO value) { var query = NHibernateSession.QueryOver <Data.ControlCenter.Model.AccountUser>() .Where(de => de.UserName == value.UserName) .Where(de => de.Password == value.Password) .List(); IList <AccountUserDTO> cDTO = AutoMapper.Mapper.Map <IList <Data.ControlCenter.Model.AccountUser>, IList <AccountUserDTO> >(query); var UserLog = new AccountUserDTO(); foreach (var item in cDTO) { UserLog = item; break; } NHibernateSessionClose(); return(UserLog); }
public ResponseDTO CrearRegistro([FromBody] AccountUserDTO value) { var Response = new ResponseDTO(); Data.ControlCenter.Model.AccountUser u = new Data.ControlCenter.Model.AccountUser(); u = AutoMapper.Mapper.Map <AccountUserDTO, Data.ControlCenter.Model.AccountUser>(value); FuncionLogActualizaciones L = new FuncionLogActualizaciones(); L.LogCreacion(u.Log); uR.SaveOrUpdate(u); if (u.EntityID > 0) { Response.Success = true; Response.Message = "Creado"; } return(Response); }
public ResponseDTO UpdateRegistro([FromBody] AccountUserDTO value) { var Response = new ResponseDTO(); Data.ControlCenter.Model.AccountUser u; u = uR.GetById(value.EntityID, false); u = AutoMapper.Mapper.Map(value, u); FuncionLogActualizaciones L = new FuncionLogActualizaciones(); L.LogModificacion(u.Log); uR.SaveOrUpdate(u); uR.CommitChanges(); Response.Success = true; Response.Message = "Actualizado"; return(Response); }
public void UpdatePassword(AccountUserDTO user) { new UserDalFacade().UpdatePassword(user); }
public void Update(AccountUserDTO accountUser) { new UserDalFacade().Update(accountUser); }
public void Add(AccountUserDTO accountUser) { new UserDalFacade().Add(accountUser); }