コード例 #1
0
        public IHttpActionResult PutUSER(string id, USER uSER)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != uSER.USERNAME)
            {
                return(BadRequest());
            }

            db.Entry(uSER).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!USERExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "id,posao_id,usluga_id")] posao_usluga posao_usluga)
 {
     if (ModelState.IsValid)
     {
         db.Entry(posao_usluga).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.posao_id  = new SelectList(db.posaos, "id", "grad", posao_usluga.posao_id);
     ViewBag.usluga_id = new SelectList(db.uslugas, "id", "opis", posao_usluga.usluga_id);
     return(View(posao_usluga));
 }
コード例 #3
0
        public IHttpActionResult PutCompras(string id, Compras compras)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != compras.Cod_Compra)
            {
                return(BadRequest());
            }

            db.Entry(compras).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ComprasExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #4
0
        public ActionResult AddOrEdit(Employee emp)
        {
            try
            {
                if (emp.ImageUpload != null)
                {
                    var fileName  = Path.GetFileNameWithoutExtension(emp.ImageUpload.FileName);
                    var extension = Path.GetExtension(emp.ImageUpload.FileName);
                    fileName      = fileName + DateTime.Now.ToString("yy-MMM-dd ddd") + extension;
                    emp.ImagePath = "~/AppFiles/ImageFiles/" + fileName;
                    emp.ImageUpload.SaveAs(Path.Combine(Server.MapPath("~/AppFiles/ImageFiles/"), fileName));
                }

                using (DbModels db = new DbModels())
                {
                    if (emp.EmployeeId == 0)
                    {
                        db.Employees.Add(emp);
                        db.SaveChanges();
                    }
                    else
                    {
                        db.Entry(emp).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                }


                return(Json(new { success = true, html = GlobalClass.RenderRazorViewToString(this, "ViewAll", GetAllEmployee()), Message = "Submitted Successfully!" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { success = false, Message = e.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #5
0
        public IHttpActionResult PutEnvio(string id, Envio envio)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != envio.Cod_Envio)
            {
                return(BadRequest());
            }

            db.Entry(envio).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EnvioExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #6
0
        public IHttpActionResult PutDOCUMENT(string id, DOCUMENT dOCUMENT)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dOCUMENT.STU_ID)
            {
                return(BadRequest());
            }

            db.Entry(dOCUMENT).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DOCUMENTExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #7
0
        public IHttpActionResult PutPROGRAM(int id, PROGRAM pROGRAM)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pROGRAM.PRO_ID)
            {
                return(BadRequest());
            }

            db.Entry(pROGRAM).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PROGRAMExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #8
0
        public IHttpActionResult PutCATEGORY(int id, CATEGORY cATEGORY)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cATEGORY.CATE_ID)
            {
                return(BadRequest());
            }

            db.Entry(cATEGORY).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CATEGORYExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #9
0
        public IHttpActionResult PutYEAR(int id, YEAR yEAR)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != yEAR.YEAR_ID)
            {
                return(BadRequest());
            }

            db.Entry(yEAR).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!YEARExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #10
0
        public IHttpActionResult PutINTAKE(int id, INTAKE iNTAKE)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != iNTAKE.INTAKE_ID)
            {
                return(BadRequest());
            }

            db.Entry(iNTAKE).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!INTAKEExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #11
0
        public IHttpActionResult PutBRANCH(int id, BRANCH bRANCH)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != bRANCH.BRANCH_ID)
            {
                return(BadRequest());
            }

            db.Entry(bRANCH).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BRANCHExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #12
0
 public ActionResult Edit(int id, User user)
 {
     using (DbModels dbModel = new DbModels())
     {
         dbModel.Entry(user).State = EntityState.Modified;
         dbModel.SaveChanges();
     }
     return(RedirectToAction("Index", "User"));
 }
コード例 #13
0
 public ActionResult Edit([Bind(Include = "id,grad,lokacija,sklopljen,zavrsen,trajanje_od,trajanje_do")] posao posao)
 {
     if (ModelState.IsValid)
     {
         if (posao.zavrsen.Length != 1)
         {
             throw new Exception("Duljina polja završen mora biti točno 1");
         }
         if (posao.sklopljen.Length != 1)
         {
             throw new Exception("Duljina polja sklopljen mora biti točno 1");
         }
         db.Entry(posao).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(posao));
 }
コード例 #14
0
        public ActionResult Editar(String codigo_juego, Juego_Favorito juego_Favorito)
        {
            using (DbModels dbModel = new DbModels())
            {
                dbModel.Entry(juego_Favorito).State = System.Data.Entity.EntityState.Modified;
                dbModel.SaveChanges();
            }

            return(RedirectToAction("List"));
        }
コード例 #15
0
 public ActionResult Edit([Bind(Include = "id,naziv")] usluga_kategorija usluga_kategorija)
 {
     if (ModelState.IsValid)
     {
         db.Entry(usluga_kategorija).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(usluga_kategorija));
 }
コード例 #16
0
ファイル: ServicesController.cs プロジェクト: soumya4525/LMS
 public ActionResult Edit([Bind(Include = "ServiceId,ServiceName,ServicePrice")] Service service)
 {
     if (ModelState.IsValid)
     {
         db.Entry(service).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(service));
 }
コード例 #17
0
 public ActionResult Edit([Bind(Include = "Cod_Clientes,Nombre_Cliente,Apellido_Cliente,Direccion_Cliente,Correo,Telefono_Cliente,Password")] Clientes clientes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clientes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(clientes));
 }
コード例 #18
0
 public ActionResult Edit([Bind(Include = "id,naziv")] certifikat certifikat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(certifikat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(certifikat));
 }
コード例 #19
0
 public ActionResult Edit([Bind(Include = "UserId,UserName,Email,MobileNo,Address,Password,UserType")] UserRegistration userRegistration)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userRegistration).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userRegistration));
 }
コード例 #20
0
 public ActionResult Edit([Bind(Include = "Id,Nombre")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
コード例 #21
0
 public ActionResult Edit([Bind(Include = "id,raspisala_osoba,opis,iznos,datum_od,datum_do,pobjednik,prihvacen_iznos")] natjecaj natjecaj)
 {
     if (ModelState.IsValid)
     {
         db.Entry(natjecaj).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(natjecaj));
 }
コード例 #22
0
 public ActionResult Edit([Bind(Include = "idConsumo,userNameColaborador,tipoConsumo,lectura,fechaCreacion")] Consumo consumo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(consumo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(consumo));
 }
コード例 #23
0
 public ActionResult Edit([Bind(Include = "Id,Code,Name,Email,City,CNIC,Contact_No,BrokerID")] broker broker)
 {
     if (ModelState.IsValid)
     {
         db.Entry(broker).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Admin"));
     }
     return(View(broker));
 }
コード例 #24
0
 public ActionResult Edit([Bind(Include = "userNameColaborador,nombreUsuario,Email,Password,sector,localidad,tipoUsuario,fechaCreacion")] Colaborador colaborador)
 {
     if (ModelState.IsValid)
     {
         db.Entry(colaborador).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(colaborador));
 }
コード例 #25
0
 public ActionResult Edit([Bind(Include = "UserID,Image,Fullname,Username,Password,Age,CNIC,Adress,Contact_no,Email,Salary,Gender,Religion,Cast,Profession,Account_no,City")] user user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
コード例 #26
0
 public ActionResult Edit([Bind(Include = "Cod_Repartidores,CI,Telefono_Repartidor,Nombre_Repartidor,Placa")] Repartidores repartidores)
 {
     if (ModelState.IsValid)
     {
         db.Entry(repartidores).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(repartidores));
 }
コード例 #27
0
 public ActionResult Edit([Bind(Include = "id,ime,prezime,datum_rodjenja,zauzet")] osoblje osoblje)
 {
     if (ModelState.IsValid)
     {
         db.Entry(osoblje).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(osoblje));
 }
コード例 #28
0
 public ActionResult Edit([Bind(Include = "id,naziv,adresa")] skladiste skladiste)
 {
     if (ModelState.IsValid)
     {
         db.Entry(skladiste).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(skladiste));
 }
コード例 #29
0
 public ActionResult Edit([Bind(Include = "numReporte,numReporteUsr,userName,Descripcion,situacion,ubicacion,longitud,latitud,FotoUrl,Comentarios,estatus,fechaCreacion,fechaCorreccion")] Reporte reporte)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reporte).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(reporte));
 }
コード例 #30
0
 public ActionResult Edit([Bind(Include = "Pid,Name,MobileNo,Email,Address")] PickupBoy pickupBoy)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pickupBoy).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pickupBoy));
 }