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; }
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); }
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); }