Exemplo n.º 1
0
        public ActionResult Create(mahasiswa mahasiswa)
        {
            if (ModelState.IsValid)
            {
                db.mahasiswas.Add(mahasiswa);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(mahasiswa));
        }
Exemplo n.º 2
0
        public ActionResult Create(Anak anak)
        {
            if (ModelState.IsValid)
            {
                db.Anaks.Add(anak);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(anak));
        }
Exemplo n.º 3
0
        public ActionResult Create(OrangTua orangtua)
        {
            if (ModelState.IsValid)
            {
                db.OrangTuas.Add(orangtua);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(orangtua));
        }
Exemplo n.º 4
0
        public ActionResult Create(category category)
        {
            if (ModelState.IsValid)
            {
                db.categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
Exemplo n.º 5
0
        public ActionResult Create(Member member)
        {
            if (ModelState.IsValid)
            {
                db.Members.Add(member);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(member));
        }
Exemplo n.º 6
0
        public ActionResult Create(Trans_M trans_m)
        {
            if (ModelState.IsValid)
            {
                db.Trans_M.Add(trans_m);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.MemberId = new SelectList(db.Members, "MemberId", "MemberName", trans_m.MemberId);
            return(View(trans_m));
        }
Exemplo n.º 7
0
        public ActionResult Create(item item)
        {
            if (ModelState.IsValid)
            {
                db.items.Add(item);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Category = new SelectList(db.categories, "CategoryId", "CategoryName", item.Category);
            return(View(item));
        }
Exemplo n.º 8
0
        public ActionResult Create(Trans_d trans_d)
        {
            if (ModelState.IsValid)
            {
                db.Trans_d.Add(trans_d);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ItemId  = new SelectList(db.items, "ItemId", "ItemName", trans_d.ItemId);
            ViewBag.TransId = new SelectList(db.Trans_M, "TransId", "TransId", trans_d.TransId);
            return(View(trans_d));
        }
Exemplo n.º 9
0
        public ActionResult Create(credit credit)
        {
            if (ModelState.IsValid)
            {
                db.credits.Add(credit);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ItemId   = new SelectList(db.items, "ItemId", "ItemName", credit.ItemId);
            ViewBag.MemberId = new SelectList(db.Members, "MemberId", "MemberName", credit.MemberId);
            return(View(credit));
        }
Exemplo n.º 10
0
        public HttpResponseMessage Putmember(int id, Member member)
        {
            if (ModelState.IsValid && id == member.MemberId)
            {
                db.Entry(member).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 11
0
        // PUT api/Siswa/5
        public HttpResponseMessage Putmahasiswa(string id, mahasiswa mahasiswa)
        {
            if (ModelState.IsValid && id == mahasiswa.MhsId)
            {
                db.Entry(mahasiswa).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 12
0
        // PUT api/trans_mapi/5
        public HttpResponseMessage PutTrans_M(string id, Trans_M trans_m)
        {
            if (ModelState.IsValid && id == trans_m.TransId)
            {
                db.Entry(trans_m).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }