Example #1
0
        public ActionResult Post([FromBody] GroupTypeRequest groupTypeRequest)
        {
            var entity = groupTypeRequest.TO <GroupType>();
            var result = _repository.Add(entity);

            return(CreatedAtAction(nameof(Get), new { id = result.GroupTypeId }, result.TO <GroupTypeResponse>()));
        }
Example #2
0
        public ActionResult Put(Guid id, [FromBody] GroupTypeRequest groupTypeRequest)
        {
            var entity = _repository.Get(id);

            if (entity != null)
            {
                entity = groupTypeRequest.CopyTo(entity);

                _repository.Update(entity);
                return(new OkObjectResult(entity.TO <GroupTypeResponse>()));
            }
            return(new NoContentResult());
        }
Example #3
0
        public BaseResponse UpdateGroupType(GroupTypeRequest request)
        {
            BaseResponse groupTypeResponse = new BaseResponse();

            try
            {
                var orderID = repository.UpdateGroupType(request.groupType);
                groupTypeResponse.Success = true;
            }
            catch (Exception ex)
            {
                groupTypeResponse.Success    = false;
                groupTypeResponse.Message    = ex.Message;
                groupTypeResponse.StackTrace = ex.StackTrace;
            }

            return(groupTypeResponse);
        }
Example #4
0
 public BaseResponse UpdateGroupType(GroupTypeRequest request)
 {
     return(service.UpdateGroupType(request));
 }
Example #5
0
 public BaseResponse CreateGroupType(GroupTypeRequest request)
 {
     return(service.InsertGroupType(request));
 }