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)); }
// GET: Consumos public void Receive(string userNameColaborador, string lecturaConsumo) { Consumo consumo = new Consumo(userNameColaborador, lecturaConsumo); // Se recibe las lecturas String l = lecturaConsumo; // Se separan las lecturas por usuario String[] lecturas = l.Split('-'); //Se recorren las lecturas for (int i = 0; i < lecturas.Length; i++) { // Se separan los datos usuario y lectura String[] datos = lecturas[i].Split(','); Consumo c = new Consumo(datos[1], datos[0]); db.Consumos.Add(c); } db.SaveChanges(); }
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)); }
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)); }
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)); } }
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)); }
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)); }
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)); }
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)); }
public ActionResult Allow(int id) { user table_2 = db.users.Find(id); registered_users rguser = new registered_users { UserID = table_2.UserID, Fullname = table_2.Fullname, Image = table_2.Image, Account_no = table_2.Account_no, Adress = table_2.Adress, Age = table_2.Age, Cast = table_2.Cast, City = table_2.City, CNIC = table_2.CNIC, Contact_no = table_2.Contact_no, Email = table_2.Email, Gender = table_2.Gender, Password = table_2.Password, Profession = table_2.Profession, Religion = table_2.Religion, Salary = table_2.Salary, Username = table_2.Username }; db.registered_users.Add(rguser); db.users.Remove(table_2); db.SaveChanges(); return(RedirectToAction("requests")); }
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)); }
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)); }
public void Crear(int numReporteUsr, string userName, string situacion, double longitud, double latitud, string sector) { /* Se verifica si hay un reporte del usuario con * el numReporteUsr que se quiere agegar al reporte*/ var reporte = (from n in db.Reportes where n.userName == userName && n.numReporteUsr == numReporteUsr select n); /** * Se verifica si el colaborador que hace el reporte existe */ //var colab = (from n in db.Colaboradores // where n.idColaborador == idUsuario // select n); /** * Si no se encontro el reporte y el colaborador existe, crea uno nuevo */ //if (reporte.Count() == 0 && colab.Count()>0 ) //{ Reporte report = new Reporte(numReporteUsr, userName, situacion, longitud, latitud, sector); db.Reportes.Add(report); db.SaveChanges(); //} }
public ActionResult Create([Bind(Include = "Cod_Clientes,Nombre_Cliente,Apellido_Cliente,Direccion_Cliente,Correo,Telefono_Cliente,Password")] Clientes clientes) { if (ModelState.IsValid) { db.Clientes.Add(clientes); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clientes)); }
public ActionResult Create([Bind(Include = "Pid,Name,MobileNo,Email,Address")] PickupBoy pickupBoy) { if (ModelState.IsValid) { db.PickupBoys.Add(pickupBoy); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pickupBoy)); }
public ActionResult Create([Bind(Include = "id,naziv")] certifikat certifikat) { if (ModelState.IsValid) { db.certifikats.Add(certifikat); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(certifikat)); }
public ActionResult Create([Bind(Include = "id,naziv,adresa")] skladiste skladiste) { if (ModelState.IsValid) { db.skladistes.Add(skladiste); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(skladiste)); }
public ActionResult Create([Bind(Include = "ServiceId,ServiceName,ServicePrice")] Service service) { if (ModelState.IsValid) { db.Services.Add(service); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(service)); }
public ActionResult Create([Bind(Include = "id,naziv")] usluga_kategorija usluga_kategorija) { if (ModelState.IsValid) { db.usluga_kategorija.Add(usluga_kategorija); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(usluga_kategorija)); }
public ActionResult Create([Bind(Include = "Cod_Repartidores,CI,Telefono_Repartidor,Nombre_Repartidor,Placa")] Repartidores repartidores) { if (ModelState.IsValid) { db.Repartidores.Add(repartidores); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(repartidores)); }
public ActionResult Create([Bind(Include = "id,raspisala_osoba,opis,iznos,datum_od,datum_do,pobjednik,prihvacen_iznos")] natjecaj natjecaj) { if (ModelState.IsValid) { db.natjecajs.Add(natjecaj); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(natjecaj)); }
public ActionResult Create([Bind(Include = "id,naziv,opis")] zanimanje zanimanje) { if (ModelState.IsValid) { db.zanimanjes.Add(zanimanje); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(zanimanje)); }
public ActionResult Create([Bind(Include = "id,ime,prezime,datum_rodjenja,zauzet")] osoblje osoblje) { if (ModelState.IsValid) { db.osobljes.Add(osoblje); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(osoblje)); }
public ActionResult Create([Bind(Include = "id,tip,cijena,opis")] usluga usluga) { if (ModelState.IsValid) { db.uslugas.Add(usluga); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.tip = new SelectList(db.usluga_kategorija, "id", "naziv", usluga.tip); return(View(usluga)); }
public ActionResult Create([Bind(Include = "id,broj_osoblja,iznos,natjecaj_id,dobitna_ponuda")] natjecaj_ponuda natjecaj_ponuda) { if (ModelState.IsValid) { db.natjecaj_ponuda.Add(natjecaj_ponuda); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.natjecaj_id = new SelectList(db.natjecajs, "id", "raspisala_osoba", natjecaj_ponuda.natjecaj_id); return(View(natjecaj_ponuda)); }
public ActionResult Create([Bind(Include = "id,datum,prihod,trosak,osoblje_id")] transakcija_osoblje transakcija_osoblje) { if (ModelState.IsValid) { db.transakcija_osoblje.Add(transakcija_osoblje); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.osoblje_id = new SelectList(db.osobljes, "id", "ime", transakcija_osoblje.osoblje_id); return(View(transakcija_osoblje)); }
public ActionResult Create([Bind(Include = "id,koristenje_od,koristenje_do,tip,osoba,oprema_id")] unajmljena_oprema unajmljena_oprema) { if (ModelState.IsValid) { db.unajmljena_oprema.Add(unajmljena_oprema); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.oprema_id = new SelectList(db.opremas, "id", "naziv", unajmljena_oprema.oprema_id); return(View(unajmljena_oprema)); }
public ActionResult Create([Bind(Include = "id,posao_id,transakcija_osoblje_id")] posao_transakcija_osoblje posao_transakcija_osoblje) { if (ModelState.IsValid) { db.posao_transakcija_osoblje.Add(posao_transakcija_osoblje); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.posao_id = new SelectList(db.posaos, "id", "grad", posao_transakcija_osoblje.posao_id); ViewBag.transakcija_osoblje_id = new SelectList(db.transakcija_osoblje, "id", "id", posao_transakcija_osoblje.transakcija_osoblje_id); return(View(posao_transakcija_osoblje)); }
public ActionResult Create([Bind(Include = "id,osoblje_id,zanimanje_id")] osoblje_zanimanje osoblje_zanimanje) { if (ModelState.IsValid) { db.osoblje_zanimanje.Add(osoblje_zanimanje); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.osoblje_id = new SelectList(db.osobljes, "id", "ime", osoblje_zanimanje.osoblje_id); ViewBag.zanimanje_id = new SelectList(db.zanimanjes, "id", "naziv", osoblje_zanimanje.zanimanje_id); return(View(osoblje_zanimanje)); }
public ActionResult Create([Bind(Include = "id,certifikat_id,osoblje_id")] certifikat_osoblje certifikat_osoblje) { if (ModelState.IsValid) { db.certifikat_osoblje.Add(certifikat_osoblje); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.certifikat_id = new SelectList(db.certifikats, "id", "naziv", certifikat_osoblje.certifikat_id); ViewBag.osoblje_id = new SelectList(db.osobljes, "id", "ime", certifikat_osoblje.osoblje_id); return(View(certifikat_osoblje)); }