Exemplo n.º 1
0
        public async Task <JsonResult> CreateGood(GoodRequestModel goodRequestModel)
        {
            if (CurrentUserEntity.RoleId != RolesContext.Administrator && CurrentUserEntity.Id != goodRequestModel.PartnerId)
            {
                return(new JsonResult(new { statusCode = 401, message = "Unauthorized" }));
            }

            var goodModel = await _goodService.CreateNewGood(goodRequestModel, CdnPath, _webHostEnvironment.WebRootPath);

            return(new JsonResult(new { statusCode = 200, message = "OK", data = goodModel }));
        }