Exemple #1
0
        public HttpResponseMessage Put(int id, [FromBody] CoordinatorViewModel coordinatorViewModel)
        {
            try
            {
                var userId    = this.User.FindFirstValue(ClaimTypes.Name);
                var tempUsers = AutoMapper.Mapper.Map <Users>(coordinatorViewModel);
                tempUsers.CreatedDate = DateTime.Now;
                tempUsers.Createdby   = Convert.ToInt32(userId);
                tempUsers.Password    = EncryptLib.EncryptText(coordinatorViewModel.Password);
                _users.UpdateUsers(tempUsers);
                var tempCoordinator = AutoMapper.Mapper.Map <Coordinator>(coordinatorViewModel);
                _coordinator.UpdateCoordinator(tempCoordinator);
                var response = new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.OK
                };

                return(response);
            }
            catch (Exception)
            {
                var response = new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.InternalServerError
                };
                return(response);
            }
        }