コード例 #1
0
 public RecyclingBank(RecyclingBankCreateRequest data, string uniq)
 {
     Plastic       = data.Plastic;
     Paper         = data.Paper;
     WhiteGlass    = data.WhiteGlass;
     ColouredGlass = data.ColouredGlass;
     Metal         = data.Metal;
     Capacity      = data.Capacity;
     Position      = data.Position;
     Creator       = uniq;
 }
コード例 #2
0
        public RecyclingBank Create([FromBody] RecyclingBankCreateRequest entity)
        {
            ResponseMessage <RecyclingBank> request = _recyclingBankService.Create(entity, User.Identity.Name);

            if (!request.IsSuccess)
            {
                throw new Exception(request.ErrorMessage);
            }

            return(request.ResponseObject);
        }
コード例 #3
0
        public ResponseMessage <RecyclingBank> Create(RecyclingBankCreateRequest data, string uniq)
        {
            ResponseMessage <RecyclingBank> response = new ResponseMessage <RecyclingBank>();

            try
            {
                RecyclingBank user = new RecyclingBank(data, uniq.Reverse());

                response.ResponseObject = _recyclingBankRepository.Create(user);
                response.IsSuccess      = true;
                response.ErrorMessage   = "Success";
            }
            catch (Exception ex)
            {
                response.IsSuccess    = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }