public ActionResult New(UserDateRights udr) { UserDateRightsDL urd = new UserDateRightsDL(); bool res = urd.Insert_Update(udr.UserId, udr.DaysForward, udr.DaysBack, udr.IsActive); if (res) { TempData["msg_success"] = "save successfully"; return(Redirect(Request.UrlReferrer.ToString())); //return RedirectToAction("all", "user"); } else { TempData["msg_error"] = "some error"; return(View(new { id = udr.UserId })); } }
public UserDateRights Single(string filter, string value) { DataTable dt = udrdl.Get(filter, value); UserDateRights udr = new UserDateRights(); if (dt.Rows.Count > 0) { udr.Id = int.Parse(dt.Rows[0]["Id"].ToString()); udr.UserId = int.Parse(dt.Rows[0]["UserId"].ToString()); udr.DaysForward = int.Parse(dt.Rows[0]["DaysForward"].ToString()); udr.DaysBack = int.Parse(dt.Rows[0]["DaysBack"].ToString()); udr.AssignDate = DateTime.Parse(dt.Rows[0]["AssignDate"].ToString()); udr.IsActive = bool.Parse(dt.Rows[0]["IsActive"].ToString()); } return(udr); }