Ejemplo n.º 1
0
 public ActionResult AddPub(Publication publication)
 {
     Validation_Classes.Validation v1 = new Validation_Classes.Validation();
     v1.ValidatePublication(publication, ModelState);
     if (ModelState.IsValid)
     {
         publication.EmployeeId = Convert.ToInt32(Session["EmpId"]);
         publication.InsertPublication();
     }
     else
     {
         publication.EmployeeId = int.Parse(Session["EmpId"].ToString());
         ViewBag.data           = publication.GetPublications();
         ViewBag.Openform       = true;
         return(View("Index", publication));
     }
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 2
0
        public ActionResult UpdatePub(Publication publication)
        {
            Validation_Classes.Validation v1 = new Validation_Classes.Validation();
            v1.ValidatePublication(publication, ModelState);
            if (publication.File == null)
            {
                ModelState.Remove("File");
            }

            if (ModelState.IsValid)
            {
                //save
                publication.EmployeeId = Convert.ToInt32(Session["EmpId"]);
                publication.UpdatePublication();
            }
            else
            {
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }