Exemple #1
0
        public ActionResult CreateOrEdit(Project_StatusEntity entity, int?id)
        {
            if (!ModelState.IsValid)
            {
                return(View(entity));
            }
            int projecStatusId = 0;

            if (id.HasValue && id.Value > 0)
            {
                var entityTemp = _iplProjectStatus.ViewDetail(id.Value);
                if (entityTemp == null)
                {
                    ViewBag.MgsNotFound = "Không tìm thấy trạng thái dự án";
                    return(View(entity));
                }
                projecStatusId      = id.Value;
                entityTemp.Name     = entity.Name;
                entityTemp.IsActive = entity.IsActive;
                _iplProjectStatus.Update(entityTemp);
            }
            else
            {
                projecStatusId = _iplProjectStatus.Insert(entity);

                return(RedirectToAction("Index"));
            }
            if (projecStatusId == -1)
            {
                ModelState.AddModelError("Name", "Trùng tên. Có thể danh mục này đã bị xóa. Bạn có thể kiểm tra trong thùng rác");
                return(View(entity));
            }
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public ActionResult CreateOrEdit(int?id)
        {
            Project_StatusEntity entity = new Project_StatusEntity();

            if (id.HasValue)
            {
                ViewBag.Title    = "Sửa trạng thái dự án";
                ViewBag.SubTitle = "Sửa thông tin trạng thái dự án";
                entity           = _iplProjectStatus.ViewDetail(id.Value);
                if (entity == null)
                {
                    return(HttpNotFound("Không có thông tin trạng thái dự án"));
                }
                return(View(entity));
            }
            ViewBag.Title    = "Thêm trạng thái dự án";
            ViewBag.SubTitle = "Thêm thông tin trạng thái dự án";
            return(View(entity));
        }