public JsonResult ClassEdit(int ClassId, ClassModel ClassModel) { try { if (ClassId == 0) { Core3Base.Infra.Data.Entity.Classs classs = new Core3Base.Infra.Data.Entity.Classs { ClassName = ClassModel.Classs.ClassName, IsActive = ClassModel.Classs.IsActive, }; return(Json(_classService.Add(classs).HttpGetResponse())); } else { var Class = _classService.GetClasssById(ClassId).Result; Class.IsActive = ClassModel.Classs.IsActive; Class.ClassName = ClassModel.Classs.ClassName; return(Json(_classService.Update(Class).HttpGetResponse())); } } catch (Exception e) { return(Json(e.Message)); } }
public IActionResult Add([FromQuery] ClasssViewModel model) { var ClasssResponse = _ClasssService.Add(new Classs { ClassName = model.ClassName }); if (ClasssResponse.IsSucceeded && ClasssResponse.Result != null) { return(Ok(ClasssResponse.Result)); } return(ClasssResponse.HttpGetResponse()); }