Ejemplo n.º 1
0
        public ActionResult UpdateGroup(int id, UserGroup userGroupToUpdate)
        {
            if (id != userGroupToUpdate.Id)
            {
                return(BadRequest());
            }

            var updateUserGroup = _repository.UpdateUserGroup(userGroupToUpdate);

            return(Ok(updateUserGroup));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(UserGroupVM model)
        {
            try
            {
                string userGroupId = string.Empty;
                model.UpdatedBy = LogInManager.LoggedInUserId;

                #region Check User Group Name Exist.

                if (this.CheckUserGroupNameExist(model.Id, model.Name) == false)
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = string.Format("Name : {0} already exist.", model.Name)
                    }, JsonRequestBehavior.AllowGet));
                }

                #endregion

                userGroupId = userGroupRepository.UpdateUserGroup(model);

                if (!string.IsNullOrWhiteSpace(userGroupId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            UserGroupId = userGroupId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "User Group details not updated successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Edit");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }
Ejemplo n.º 3
0
        public void TestUpdateUserAccount()
        {
            var usergroupId = 4;
            var usergroup   = sut.GetUserGroupById(usergroupId);

            String timeStamp = DateTime.Now.ToString("yyyyMMddhhmmss");

            usergroup.Name = $"UserGroup{timeStamp}";

            sut.UpdateUserGroup(usergroup);

            var updatedUserGroup = sut.GetUserGroupById(usergroup.Id);

            Assert.AreEqual(expected: usergroup.Id, actual: updatedUserGroup.Id);
            Assert.AreEqual(expected: usergroup.Name, actual: updatedUserGroup.Name);
        }