Esempio n. 1
0
        public ActionResult Delete(Guid id)
        {
            try
            {
                string userGroupId = string.Empty;

                #region Check College Group Mapping Exist

                var collegeGroups = collegeGroupRepository.GetCollegeGroupByUserGroupId(id);

                if (collegeGroups != null && collegeGroups.Count > 0)
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "You can not delete this user group because there are one or more colleges assigned with this user group."
                    }, JsonRequestBehavior.AllowGet));
                }
                #endregion

                userGroupId = userGroupRepository.DeleteUserGroup(id, LogInManager.LoggedInUserId);

                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 deleted successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Delete");
                return(Json(new { IsSuccess = false, errorMessage = e.Message }));
            }
        }
Esempio n. 2
0
        public void TestInsertAndDelete()
        {
            String timeStamp = DateTime.Now.ToString("yyyyMMddhhmmss");
            var    usergroup = new UserGroupDTOComponent
            {
                Name = "New User",
            };

            sut.InsertUserGroup(usergroup);
            var usergroupId       = usergroup.Id;
            var insertedUserGroup = sut.GetUserGroupById(usergroupId);

            sut.DeleteUserGroup(usergroup);
            var deletedUserAccount = sut.GetUserGroupById(usergroupId);

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

            Assert.IsNull(deletedUserAccount);
        }
Esempio n. 3
0
 public bool DeleteUserGroup(int groupID)
 {
     return(UserGroupRepository.DeleteUserGroup(groupID));
 }
 public ActionResult DeleteUserGroup(int id)
 {
     _repository.DeleteUserGroup(id);
     return(Ok("userGroup is deleted"));
 }