public UsersDTO FindById(int id) { UsersDTO model = new UsersDTO(); userModel = userService.Find(id); Mapper.CreateMap<Users, UsersDTO>(); model = Mapper.Map<UsersDTO>(userModel); return model; }
public UsersDTO FindByEmail(string email) { UsersDTO model = new UsersDTO(); userModel = userService.FindByEmail(email); Mapper.CreateMap<Users, UsersDTO>(); model = Mapper.Map<UsersDTO>(userModel); return model; }
public string CreateEntity(Users model) { string transactionMessage = ""; try { db.Users.Add(model); db.SaveChanges(); transactionMessage = "Succes!"; } catch (Exception ex) { transactionMessage = "Error " + ex.Message; } return transactionMessage; }
public void Transform_Users_UsersDTO(UsersDTO model) { Mapper.CreateMap<UsersDTO, Users>(); userModel = Mapper.Map<Users>(model); }
public string UpdateEntity(Users model) { String transactionMessage = null; try { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); transactionMessage = "User updated!"; } catch(Exception ex) { transactionMessage = "Error: " + ex.Message; } return transactionMessage; }