Пример #1
0
 public IHttpActionResult EndSmallGroup([FromUri] int groupId)
 {
     return(Authorized(token =>
     {
         try
         {
             _groupToolService.VerifyCurrentUserIsGroupLeader(token, groupId);
             _groupToolService.EndGroup(groupId, 4);
             return Ok();
         }
         catch (Exception e)
         {
             _logger.Error("Could not end group: " + groupId, e);
             return BadRequest();
         }
     }));
 }
Пример #2
0
        public IHttpActionResult EditGroup([FromBody] GroupDTO group)
        {
            return(Authorized(token =>
            {
                try
                {
                    _groupToolService.VerifyCurrentUserIsGroupLeader(token, @group.GroupId);
                    if (group.Address != null && string.IsNullOrEmpty(group.Address.AddressLine1) == false)
                    {
                        _addressService.FindOrCreateAddress(group.Address, true);
                    }

                    group = _groupService.UpdateGroup(group);
                    _logger.DebugFormat("Successfully updated group {0} ", group.GroupId);
                    return (Created(string.Format("api/group/{0}", group.GroupId), group));
                }
                catch (Exception e)
                {
                    _logger.Error("Could not update group", e);
                    return BadRequest();
                }
            }));
        }