public async Task <ActionResult> Delete(int?id)  //GET: /POImages
        {
            if (id == null)
            {
                return(BadRequestTextResult());
            }
            POImage pOImage = await FindAsyncPOImage(id.Value);

            if (pOImage == null)
            {
                return(NotFoundTextResult());
            }

            DataContext.POImages.Remove(pOImage);
            try
            {
                await DataContext.SaveChangesAsync(this);
            }
            catch (Exception ex)
            {
                var sb = new StringBuilder();
                sb.Append(MessageStrings.CanNotDelete);
                sb.Append(pOImage.ImageTitle);
                sb.Append("<br/>");
                AppendExceptionMsg(ex, sb);

                return(StatusCodeTextResult(sb, HttpStatusCode.InternalServerError));
            }

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Exemple #2
0
 protected override void Constructing(POImage image)
 {
     base.Constructing(image);
     if (image.PurchaseOrder != null)
     {
         PurchaseOrder = new PurchaseOrderDTO(image.PurchaseOrder);
     }
 }
        public async Task <ActionResult> GetPOImage(int?id)
        {
            if (id == null)
            {
                return(BadRequestTextResult());
            }
            POImage pOImage = await FindAsyncPOImage(id.Value);

            if (pOImage == null)
            {
                return(NotFoundTextResult());
            }

            return(Json(new POImageDTO(pOImage), JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public async Task <ActionResult> Edit(int?id)  //GET: /POImages/Edit/5
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            POImage pOImage = await FindAsyncPOImage(id.Value);

            if (pOImage == null)
            {
                return(HttpNotFound());
            }

            var pOImageDTO = new POImageVM(pOImage);

            return(View(pOImageDTO));
        }
        public async Task <ActionResult> Details(int?id, bool?modal)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            POImage pOImage = await FindAsyncPOImage(id.Value);

            if (pOImage == null)
            {
                return(HttpNotFound());
            }

            await PutCanUserInViewBag();

            if (modal ?? false)
            {
                return(PartialView("_Details", pOImage));
            }
            return(View(pOImage));
        }
Exemple #6
0
 public POImageVM(POImage image) : base(image)
 {
 }
 partial void SetSelectLists(POImage pOImage);