public JsonResult UpdateCategory(string category_code, string category_name, string category_state, string category_note) { AjaxResultModel Result = new AjaxResultModel(); try { TB_CATEGORIES t = Categories_Service.GetById(category_code); t.CategoryName = category_name; t.CategoryState = category_state; t.CategoryNote = category_note; if (Categories_Service.Update(t)) { Result.Code = 000; Result.Result = "Thành công"; } else { Result.Code = 001; Result.Result = "Không thành công"; } } catch (Exception Ex) { Result.Code = 2000; Result.Result = "Có lỗi xảy ra. Vui lòng thử lại sau hoặc liên hệ với người quản trị."; CORE.Helpers.IOHelper.WriteLog(StartUpPath, IpAddress, "UpdatePassword :", Ex.Message, Ex.ToString()); } return(Json(Result)); }
public IHttpActionResult Put(TB_CATEGORIES tB_CATEGORIES) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(tB_CATEGORIES).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TB_CATEGORIESExists(tB_CATEGORIES.id_cat)) { return(NotFound()); } else { throw; } } return(Ok(tB_CATEGORIES)); }
public PartialViewResult _CategoryListDetail(string categoryCode = "") { int height = (int)(Request.Browser.ScreenPixelsHeight * 0.85); TB_CATEGORIES sup = Categories_Service.GetById(categoryCode); ViewBag.Category = sup; return(PartialView(height)); }
public IHttpActionResult Get(int id) { TB_CATEGORIES tB_CATEGORIES = db.TB_CATEGORIES.Find(id); if (tB_CATEGORIES == null) { return(NotFound()); } return(Ok(tB_CATEGORIES)); }
public IHttpActionResult Delete(int id) { TB_CATEGORIES tB_CATEGORIES = db.TB_CATEGORIES.Find(id); if (tB_CATEGORIES == null) { return(NotFound()); } db.TB_CATEGORIES.Remove(tB_CATEGORIES); db.SaveChanges(); return(Ok(new { id_cat = tB_CATEGORIES.id_cat }));; }
public IHttpActionResult Post(TB_CATEGORIES tB_CATEGORIES) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } tB_CATEGORIES.dt_icl = DateTime.Now; db.TB_CATEGORIES.Add(tB_CATEGORIES); db.SaveChanges(); return(Ok(new { id_cat = tB_CATEGORIES.id_cat })); }
public bool Insert(TB_CATEGORIES category) { return(new TB_CATEGORIESSql().Insert(category, true)); }
public bool Update(TB_CATEGORIES category) { return(new TB_CATEGORIESSql().Update(category)); }