public ActionResult Add(recsys_cost data, int status2) { bool isSuccess = false; Member member = new Member("users"); data.last_update = DateTime.Now; data.update_user_id = (int)member.infoBySession("id"); data.status = (byte)(((RecordStatus)status2) == RecordStatus.Active ? 1 : 0); this._db.recsys_cost.AddObject(data); try { this._db.SaveChanges(); isSuccess = true; } catch (OptimisticConcurrencyException) { //# log down } return Json(isSuccess, JsonRequestBehavior.AllowGet); }
/// <summary> /// Deprecated Method for adding a new object to the recsys_cost EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTorecsys_cost(recsys_cost recsys_cost) { base.AddObject("recsys_cost", recsys_cost); }
/// <summary> /// Create a new recsys_cost object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="code">Initial value of the code property.</param> /// <param name="name">Initial value of the name property.</param> /// <param name="status">Initial value of the status property.</param> public static recsys_cost Createrecsys_cost(global::System.Int32 id, global::System.String code, global::System.String name, global::System.Byte status) { recsys_cost recsys_cost = new recsys_cost(); recsys_cost.id = id; recsys_cost.code = code; recsys_cost.name = name; recsys_cost.status = status; return recsys_cost; }
public ActionResult Edit(recsys_cost data, int status2) { bool isSuccess = false; Member member = new Member("users"); recsys_cost oldRecord = this._db.recsys_cost.FirstOrDefault(theCategory => theCategory.id == data.id); oldRecord.IsMinorWork = data.IsMinorWork; oldRecord.IsSubCon = data.IsSubCon; oldRecord.last_update = DateTime.Now; oldRecord.name = data.name; oldRecord.code = data.code; oldRecord.status = (byte) (((RecordStatus) status2) == RecordStatus.Active ? 1 : 0); oldRecord.update_user_id = (int) member.infoBySession("id"); try { this._db.SaveChanges(); isSuccess = true; } catch (OptimisticConcurrencyException) { //# log down } return Json(isSuccess, JsonRequestBehavior.AllowGet); }