Esempio n. 1
0
        public async Task <IActionResult> Update([FromBody] CategoryInvolveMeta categoryInvolveMeta)
        {
            var result = await _categoryInvolveService.Update(categoryInvolveMeta);

            if (result.Code <= 0)
            {
                return(BadRequest(result));
            }

            return(Ok(result));
        }
Esempio n. 2
0
        public async Task <ActionResultResponse> Insert(CategoryInvolveMeta categoryInvolveMeta)
        {
            var categoryInvolve = new CategoryInvolve
            {
                CategoryId        = categoryInvolveMeta.CategoryId,
                CategoryInvolveId = categoryInvolveMeta.CategoryInvolveId,
            };

            var result = await _categoryInvolveRepository.Insert(categoryInvolve);

            if (result <= 0)
            {
                return(new ActionResultResponse(result, _sharedResourceService.GetString("Something went wrong. Please contact with administrator.")));
            }

            return(new ActionResultResponse(-1, _resourceService.GetString("Can not insert new CategoryInvolve. Please contact with administrator.")));
        }
Esempio n. 3
0
        public async Task <ActionResultResponse> Update(CategoryInvolveMeta categoryInvolveMeta)
        {
            var checkExists = await _categoryInvolveRepository.CheckExists(categoryInvolveMeta.CategoryId, categoryInvolveMeta.CategoryInvolveId);

            if (!checkExists)
            {
                return(new ActionResultResponse(-2, _resourceService.GetString("CategoryInvolve does not exists.")));
            }

            var categoryInvolveInfo = new CategoryInvolve()
            {
                CategoryId        = categoryInvolveMeta.CategoryId,
                CategoryInvolveId = categoryInvolveMeta.CategoryInvolveId,
            };

            await _categoryInvolveRepository.Update(categoryInvolveInfo);

            return(new ActionResultResponse(1, _resourceService.GetString("Update CategoryInvolve successful.")));
        }