コード例 #1
0
 public static Error MergeFrom(this Error proto, ErrorHeader message)
 {
     proto         = proto ?? new Error();
     proto.Message = message.Message;
     proto.Details = message.Details;
     return(proto);
 }
コード例 #2
0
        public ActionResult Edit([Bind(Exclude = "Image")] ErrorHeader errorHeader, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image != null)
                {
                    if (Extensions.Extensions.CheckImageType(Image) && Extensions.Extensions.CheckImageSize(Image, 10))
                    {
                        errorHeader.Image = Extensions.Extensions.SaveImage(Server.MapPath("~/Public/images"), Image);


                        db.Entry(errorHeader).State = EntityState.Modified;
                        db.SaveChanges();

                        return(RedirectToAction("Index", "ErrorHeader"));
                    }
                    else
                    {
                        ModelState.AddModelError("Image", "The type of image is incorrect or the size of image is greater than 10 Mb.");
                    }
                }
                else
                {
                    ModelState.AddModelError("Image", "Please choose an image");
                }
            }
            return(View());
        }
コード例 #3
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(HttpNotFound("ID is missing"));
            }

            ErrorHeader errorHeader = db.ErrorHeaders.Find(id);

            if (errorHeader == null)
            {
                return(HttpNotFound("ID was not found"));
            }

            return(View(errorHeader));
        }
コード例 #4
0
 public RemoteErrorException(ErrorHeader errorHeader) : this(errorHeader.Message, errorHeader.Details)
 {
 }