Exemplo n.º 1
0
        public ActionResult Edit(int?workDoneAttachmentPK)
        {
            if (workDoneAttachmentPK != null)
            {
                IWorkDoneAttachmentsRepository workDoneAttachmentsRepository = new WorkDoneAttachmentsRepository(db);
                WorkDoneAttachment             workDoneAttachment            = workDoneAttachmentsRepository.GetWorkDoneAttachmentByPK((int)workDoneAttachmentPK);
                WorkDoneAttachmentView         workDoneAttachmentView        = new WorkDoneAttachmentView();

                workDoneAttachmentView.ConvertFrom(workDoneAttachment, workDoneAttachmentView);

                //WorkDones ddl
                IWorkDonesRepository workDonesRepository = new WorkDonesRepository(db);
                workDoneAttachmentView.WorkDones = new SelectList(workDonesRepository.GetValid().OrderBy("Description ASC").ToList(), "WorkDonePK", "Description");

                return(View(workDoneAttachmentView));
            }
            else
            {
                return(RedirectToAction("Index", "WorkDoneAttachment"));
            }
        }
Exemplo n.º 2
0
        public ActionResult Delete(int?workDoneAttachmentPK)
        {
            IWorkDoneAttachmentsRepository workDoneAttachmentsRepository = new WorkDoneAttachmentsRepository(db);

            if (workDoneAttachmentPK != null)
            {
                WorkDoneAttachment workDoneAttachment = workDoneAttachmentsRepository.GetWorkDoneAttachmentByPK((int)workDoneAttachmentPK);

                workDoneAttachment.Deleted = true;

                workDoneAttachmentsRepository.SaveChanges();
            }

            if (Request.IsAjaxRequest())
            {
                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
        }