public int PostFoodCategory(FoodCategory foodCategory) { FoodCategoryDTO foodCategoryDto = Mapper.Map <FoodCategoryDTO>(foodCategory); int id = _repo.Post(foodCategoryDto); return(id); }
public IActionResult CreateCategory(FoodCategoryClient reqObj) { if (reqObj == null) { BadRequest(); } JSONRetObj <int?> retObj = new JSONRetObj <int?>(); try { retObj.IsSuccess = true; retObj.Message = ""; FoodCategory foodCategory = Mapper.Map <FoodCategory>(reqObj); FoodCategoryDTO foodCategoryDto = Mapper.Map <FoodCategoryDTO>(foodCategory); int foodMarkerId = _repoFoodCategory.Post(foodCategoryDto); retObj.ResponseObj = foodMarkerId; } catch (Exception ex) { retObj.IsSuccess = false; retObj.Message = ex.Message; retObj.ResponseObj = null; } ViewData["RetObj"] = retObj; return(View("_Success")); }