Example #1
0
        public async Task <IActionResult> UpdateStatus(TheLoai_HeSo inputModel)
        {
            try
            {
                await HttpHelper.PostData <TheLoai_HeSo>(inputModel, $"{_domain}/api/theloai-heso/update-status");

                return(Json(new { Result = true, Message = "Cập nhật dữ liệu thành công" }));
            }
            catch (Exception ex)
            {
                return(Json(new { Result = false, Message = ex.Message }));
            }
        }
Example #2
0
        public async Task <IActionResult> Create([FromBody] TheLoai_HeSo inputModel)
        {
            try
            {
                await _TheLoai_HeSoManager.Create(inputModel);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Example #3
0
        public async Task Create(TheLoai_HeSo inputModel)
        {
            try
            {
                var result = await _unitOfWork.TheLoai_HeSoRepository.Add(inputModel);

                await _unitOfWork.SaveChange();
            }
            catch (Exception ex)
            {
                throw ex;
            };
        }
Example #4
0
        public async Task Update(TheLoai_HeSo inputModel)
        {
            try
            {
                await _unitOfWork.TheLoai_HeSoRepository.Update(inputModel);

                await _unitOfWork.SaveChange();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public async Task <IActionResult> Update([FromBody] TheLoai_HeSo inputModel)
        {
            try
            {
                var data = await _TheLoai_HeSoManager.Find_By_Id(inputModel.Id);

                if (data == null)
                {
                    throw new Exception($"{MessageConst.DATA_NOT_FOUND}");
                }
                await _TheLoai_HeSoManager.Update(inputModel);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
Example #6
0
        public async Task <IActionResult> Delete(TheLoai_HeSo inputmodel)
        {
            try
            {
                if (inputmodel.Status == (byte)StatusEnum.Removed)
                {
                    await HttpHelper.PostData <TheLoai_HeSo>(inputmodel, $"{_domain}/api/theloai-heso/delete");

                    return(Json(new { Result = true }));
                }
                else
                {
                    await HttpHelper.PostData <TheLoai_HeSo>(inputmodel, $"{_domain}/api/theloai-heso/update-status");

                    return(Json(new { Result = true }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Result = false, Message = ex.Message }));
            }
        }