public ActionResult AddProject(FormCollection colection, ProjectDKC Project) { String ProjectSymbol = colection["ProjectSymbol"]; String ProjectName = colection["ProjectName"]; int? ManagerProject = colection["ManagerProject"].Equals("0") ? (int?)null : Convert.ToInt32(colection["ManagerProject"]); String Address = colection["Address"]; DateTime?FromDate = colection["FromDate"].Equals("") ? (DateTime?)null : Convert.ToDateTime(colection["FromDate"]); DateTime?ToDate = colection["ToDate"].Equals("") ? (DateTime?)null : Convert.ToDateTime(colection["ToDate"]); int? Status = colection["Status"].Equals("0") ? (int?)null : Convert.ToInt32(colection["Status"]); var lstProjectSymbol = Ql.ProjectDKCs.Where(x => x.ProjectSymbol.Trim() == ProjectSymbol.Trim()).ToList(); var CountPr = lstProjectSymbol.Count(); if (CountPr > 0) { ViewBag.Tb = "Mã bị trùng"; ViewBag.ProjectSymbol = ProjectSymbol; ViewBag.ProjectName = ProjectName; ViewBag.ManagerProject = ManagerProject; ViewBag.Address = Address; ViewBag.FromDate = @String.Format("{0:yyyy-MM-dd}", FromDate); ViewBag.ToDate = @String.Format("{0:yyyy-MM-dd}", ToDate); ViewBag.Status = Status; ViewData["User"] = Ql.Users.Where(x => x.Status != 1 && x.IsDeleted != true).ToList(); return(View()); } else { Ql.AddProject_(ProjectSymbol, ProjectName, ManagerProject, Address, FromDate, ToDate, Status); return(RedirectToAction("Project", "Project")); } }