Example #1
0
        public IHttpActionResult PutChecklistMain(int id, ChecklistMain checklistMain)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != checklistMain.Id)
            {
                return(BadRequest());
            }

            db.Entry(checklistMain).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChecklistMainExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // GET: ChecklistMains/Create
        public ActionResult Create()
        {
            ChecklistMain checklistMain = new ChecklistMain();

            checklistMain.DueDate = DateTime.Now;
            return(View(checklistMain));
        }
Example #3
0
        public IHttpActionResult PostChecklistMain(ChecklistMain checklistMain)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            db.ChecklistMains.Add(checklistMain);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = checklistMain.Id }, checklistMain));
        }
Example #4
0
        public IHttpActionResult GetChecklistMain(int?id)
        {
            ChecklistMain checklistMain = db.ChecklistMains.Find(id);

            if (checklistMain == null)
            {
                return(NotFound());
            }

            return(Ok(checklistMain));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,LogDate,UserId,DueDate,Private,Definition")] ChecklistMain checklistMain)
 {
     AddCustomError(checklistMain.UserId);
     checklistMain.LogDate = DateTime.Now;
     checklistMain.UserId  = HttpContext.User.Identity.Name;
     if (ModelState.IsValid)
     {
         mAPIChecklistMainController.PutChecklistMain(checklistMain.Id, checklistMain);
         TempData["message"] = "success";
         return(RedirectToAction("Index"));
     }
     return(View(checklistMain));
 }
 public ActionResult Create([Bind(Include = "Id,Name,LogDate,UserId,DueDate,Private,Definition")] ChecklistMain checklistMain)
 {
     checklistMain.LogDate    = DateTime.Now;
     checklistMain.UserId     = HttpContext.User.Identity.Name;
     checklistMain.checklists = new List <Checklist>();
     if (ModelState.IsValid)
     {
         mAPIChecklistMainController.PostChecklistMain(checklistMain);
         TempData["message"] = "success";
         return(RedirectToAction("Index"));
     }
     return(View(checklistMain));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            ChecklistMain checklistMain = GetChecklistMain(id);

            AddCustomError(checklistMain.UserId);
            if (ModelState.IsValid)
            {
                mAPIChecklistMainController.DeleteChecklistMain(id);
                TempData["message"] = "success";
                return(RedirectToAction("Index"));
            }
            return(View(checklistMain));
        }
Example #8
0
        public IHttpActionResult DeleteChecklistMain(int id)
        {
            ChecklistMain checklistMain = db.ChecklistMains.Find(id);

            if (checklistMain == null)
            {
                return(NotFound());
            }

            db.ChecklistMains.Remove(checklistMain);
            db.SaveChanges();

            return(Ok(checklistMain));
        }
        // GET: ChecklistMains/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChecklistMain checklistMain = GetChecklistMain(id);

            if (checklistMain == null)
            {
                return(HttpNotFound());
            }
            return(View(checklistMain));
        }
        public ActionResult Details(int?id)
        {
            clsGenel.commentsCount = 0;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ChecklistMain checklistMain = GetChecklistMain(id);

            if (checklistMain == null)
            {
                return(HttpNotFound());
            }
            return(View(checklistMain));
        }