コード例 #1
0
 public IHttpActionResult DeleteGroupByUserId(string UserId)
 {
     try
     {
         int i = grouprepo.DeleteGroup(Guid.Parse(UserId));
         if (i == 1)
         {
             return(Ok());
         }
         else
         {
             return(BadRequest("Invalid UserId"));
         }
     }
     catch (Exception ex)
     {
         logger.Error(ex.Message);
         logger.Error(ex.StackTrace);
         return(BadRequest("Something Went Wrong"));
     }
 }
コード例 #2
0
        public IHttpActionResult DeleteGroup([FromUri] int id)
        {
            Group group;

            try
            {
                group = groupRepository.DeleteGroup(id);
            }
            catch (Exception)
            {
                throw;
            }


            return(Ok(group));
        }
コード例 #3
0
        private void DeleteGroup_Click(object sender, EventArgs e)
        {
            try
            {
                //create new group object and provide it for function to insert new group to database
                Group group = new Group();
                group.GroupId = int.Parse(DeleteGroupTexbox.Text);
                groupRepository.DeleteGroup(group);
                DeleteGroupTexbox.Clear();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }

            MessageBox.Show("Delete of Group succesful");
        }