public IActionResult PutRoleOfGroups(RoleOfGroupUM model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                var checkExist = _roleOfGroupService.CheckExist(model.RoleID, model.GroupID);
                if (checkExist != null)
                {
                    return(BadRequest("Existed!"));
                }

                var roleOfGroupInDb = _roleOfGroupService.GetByID(model.ID);
                if (roleOfGroupInDb == null)
                {
                    return(BadRequest("ID not found!"));
                }
                _mapper.Map(model, roleOfGroupInDb);
                _roleOfGroupService.Save();
                return(Ok("success"));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
 public ActionResult <RoleOfGroup> PostRoleOfGroup(RoleOfGroupCM model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         RoleOfGroup roleOfGroup = new RoleOfGroup();
         roleOfGroup = _mapper.Map <RoleOfGroup>(model);
         _roleOfGroupService.Create(roleOfGroup);
         _roleOfGroupService.Save();
         return(StatusCode(201, "Role Of Group is created!"));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }