コード例 #1
0
        public ActionResult Create(ePinRequest ObjePinRequest)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            try
            {
                if (ModelState.IsValid)
                {
                    db.ePinRequests.Add(ObjePinRequest);
                    db.SaveChanges();

                    sb.Append("Sumitted");
                    return(Content(sb.ToString()));
                }
                else
                {
                    foreach (var key in this.ViewData.ModelState.Keys)
                    {
                        foreach (var err in this.ViewData.ModelState[key].Errors)
                        {
                            sb.Append(err.ErrorMessage + "<br/>");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                sb.Append("Error :" + ex.Message);
            }

            return(Content(sb.ToString()));
        }
コード例 #2
0
        // GET: /ePinRequest/MultiViewIndex/5
        public ActionResult MultiViewIndex(int?id)
        {
            ePinRequest ObjePinRequest = db.ePinRequests.Find(id);

            ViewBag.IsWorking = 0;
            if (id > 0)
            {
                ViewBag.IsWorking  = id;
                ViewBag.FromUserId = new SelectList(db.Users, "Id", "Username", ObjePinRequest.FromUserId);
            }

            return(View(ObjePinRequest));
        }
コード例 #3
0
        // GET: /ePinRequest/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ePinRequest ObjePinRequest = db.ePinRequests.Find(id);

            if (ObjePinRequest == null)
            {
                return(HttpNotFound());
            }
            return(View(ObjePinRequest));
        }
コード例 #4
0
        // GET: /ePinRequest/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ePinRequest ObjePinRequest = db.ePinRequests.Find(id);

            if (ObjePinRequest == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FromUserId = new SelectList(db.Users, "Id", "Username", ObjePinRequest.FromUserId);

            return(View(ObjePinRequest));
        }
コード例 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            try
            {
                ePinRequest ObjePinRequest = db.ePinRequests.Find(id);
                db.ePinRequests.Remove(ObjePinRequest);
                db.SaveChanges();

                sb.Append("Sumitted");
                return(Content(sb.ToString()));
            }
            catch (Exception ex)
            {
                sb.Append("Error :" + ex.Message);
            }

            return(Content(sb.ToString()));
        }