public IActionResult Post([FromBody] UserToDoItem item) { if (item == null) { return(BadRequest()); } repository.Add(item); return(CreatedAtRoute("Get", new { id = item.Id }, item)); }
public LoginedUserDTO SignUp(SignUpUserDTO loginUser) { var config = new MapperConfiguration(cfg => cfg.CreateMap <SignUpUserDTO, User>()); var mapper = config.CreateMapper(); User user = mapper.Map <SignUpUserDTO, User>(loginUser); user.CreatedOn = DateTime.Now; user.ModifiedOn = DateTime.Now; UserRepository.Add(user); bool isCommited = true; if (isCommited) { User returnuser = UserRepository.Find(tempuser => (tempuser.Email == user.Email && tempuser.Password == user.Password)).ToList().First(); var config2 = new MapperConfiguration(cfg => cfg.CreateMap <User, LoginedUserDTO>()); var mapper2 = config2.CreateMapper(); LoginedUserDTO logineduser = mapper2.Map <User, LoginedUserDTO>(returnuser); return(logineduser); } return(null); }
public bool Create(User user) { userRepositories.Add(user); return(true); }