public IActionResult GetById(int id) { try { return(Ok(_subCategoryService.GetSubCategory(id))); } catch (Exception) { return(BadRequest("Subcategory not found")); } }
public ActionResult GetSubCategory(string Id) { SubCategoryViewModel model; if (!string.IsNullOrEmpty(Id)) { var res = _subCategoryService.GetSubCategory(Convert.ToDecimal(Id)); model = AutoMapper.Mapper.Map <SubCategoryMaster, SubCategoryViewModel>(res); } else { model = new SubCategoryViewModel(); } ViewBag.CategoryList = _categoryMasterService.GetCategoryList(); return(PartialView("AddEditSubCategory", model)); }
public ActionResult <SubCategoryDto> GetASubCategory(int id) { var subCategory = _subCategoryService.GetSubCategory(id); if (subCategory == null) { List <string> errorMessage = new List <string>(); errorMessage.Add("Đã phát sinh lỗi, vui lòng thử lại"); return(BadRequest(new ResponseDto(errorMessage, 500, subCategory))); } List <string> successMessage = new List <string>(); successMessage.Add("Lấy thông tin thành công"); var responseDto = new ResponseDto(successMessage, 200, subCategory); return(Ok(responseDto)); }
public IActionResult GetByGenderId(int id) { return(Ok(_subCategoryService.GetSubCategory(id))); }
public async Task <JsonResult> GetSubCategory([FromBody] CategoryDto Category) { var subCategory = await _subCategoryService.GetSubCategory(Category.Id); return(Json(subCategory)); }
public SubCategoryDto GetSubCategory([FromQuery] Guid id) { return(service.GetSubCategory(id)); }