public void ZmenStavBroker(int id, int stav) { BROKERI zmena = entities.BROKERI.Where(brk => brk.id == id).First(); zmena.aktivni = stav; entities.SaveChanges(); }
public Broker ToBroker(BROKERI broker) { this.id = broker.id; this.ico = broker.ico; this.start_datum = broker.start_datum; this.aktivni = broker.aktivni; this.nazev = broker.nazev; this.soubor = broker.soubor; return(this); }
public BROKERI PridejBrokera(BROKERI value) { BROKERI x = new BROKERI(); x.ico = value.ico; x.nazev = value.nazev; x.aktivni = value.aktivni; x.start_datum = Convert.ToDateTime(value.start_datum); context.BROKERI.Add(x); context.SaveChanges(); return(x); }
// POST api/<controller> public Object Post([FromBody] BROKERI value) { ServisBroker ser = new ServisBroker(); int id = ser.PridejBrokera(value).id; byte[] data; //Třídní proměnná pole byte pro konverzi z např. PDF souboru string xx; try { var fn = HostingEnvironment.MapPath("~/App_Data/smlouva.pdf"); data = File.ReadAllBytes(fn); var outFn = HostingEnvironment.MapPath("~/App_Data/Copysmlouvy.pdf"); System.IO.File.WriteAllBytes(outFn, data); } catch (Exception e) { throw new FileNotFoundException("name", "soubor smlouvy nenalezen," + " nebo soubor výstupu kopie smlouvy otevřen v jiném programu"); } //string data = "nutno odremovat řádek nad tím"; return(new { //stav = xx, extension = "pdf", idBrokera = id, smlouva = data, }); }
public BROKERI AddBroker(BROKERI Broker) { context.BROKERI.Add(Broker); context.SaveChanges(); return(Broker); }