Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            GrantMemberType grantMemberType = db.GrantMemberTypes.Find(id);

            db.GrantMemberTypes.Remove(grantMemberType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        // GET: GrantMemberTypes/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GrantMemberType grantMemberType = db.GrantMemberTypes.Find(id);

            if (grantMemberType == null)
            {
                return(HttpNotFound());
            }
            return(View(grantMemberType));
        }
Exemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "GrantMemberTypeID,Name,Description,Coefficient")] GrantMemberTypeViewModel grantMemberTypeView)
        {
            if (ModelState.IsValid)
            {
                GrantMemberType model = db.GrantMemberTypes.Find(grantMemberTypeView.GrantMemberTypeID);

                model.Name        = grantMemberTypeView.Name;
                model.Description = grantMemberTypeView.Description;
                model.Coefficient = grantMemberTypeView.Coefficient;

                model.DateModified   = DateTime.Now;
                model.UserModifiedID = Guid.Parse(User.Identity.GetUserId());

                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(grantMemberTypeView));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "Name,Description,Coefficient")] GrantMemberType grantMemberType)
        {
            if (ModelState.IsValid)
            {
                grantMemberType.GrantMemberTypeID = Guid.NewGuid();

                grantMemberType.DateCreated  = DateTime.Now;
                grantMemberType.DateModified = grantMemberType.DateCreated;

                grantMemberType.UserCreatedID  = Guid.Parse(User.Identity.GetUserId());
                grantMemberType.UserModifiedID = grantMemberType.UserCreatedID;

                db.GrantMemberTypes.Add(grantMemberType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(grantMemberType));
        }