public Model.Soba Update(int id, SobaInsertRequest update) { var entity = _context.Soba.Find(id); _mapper.Map(update, entity); _context.SaveChanges(); return(_mapper.Map <Model.Soba>(entity)); }
public Model.Soba Insert(SobaInsertRequest insert) { var entity = _mapper.Map <Database.Soba>(insert); _context.Soba.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Soba>(entity)); }
public SobaInsertRequest Insert(SobaInsertRequest model) { if (model.SobaId == 0) { Soba s = _mapper.Map <Soba>(model); _context.Soba.Add(s); _context.SaveChanges(); } return(model); }
private async void btn_Snimi_Click(object sender, EventArgs e) { HideError(); if (Validacija()) { SobaInsertRequest request = new SobaInsertRequest { BrojKreveta = int.Parse(tb_BrojKreveta.Text.ToString()), VelicinaSobe = int.Parse(tb_Velicina.Text.ToString()), Opis = tb_Opis.Text, SmjestajId = _SmjestajId, VlastitaKupoanica = cb_Kupaonica.Checked, VrstaSmjestaja = tb_VrstaSmjestaja.Text, Cijena = float.Parse(tb_Cijena.Text.ToString()), SobaId = _SobaId }; await _SobaService.Update <SobaModel>(_SobaId, request); } }
private async void btn_Snimi_Click(object sender, EventArgs e) { HideError(); bool valid = Validacija(); if (valid) { SobaInsertRequest nova = new SobaInsertRequest { BrojKreveta = int.Parse(tb_BrojKreveta.Text), Cijena = float.Parse(tb_Cijena.Text), Opis = tb_Opis.Text, VelicinaSobe = int.Parse(tb_Velicina.Text), VrstaSmjestaja = tb_Vrsta.Text, VlastitaKupoanica = cb_Kupaonica.Checked, SmjestajId = _SmjestajId }; await _SobaService.Insert <SobaInsertRequest>(nova); Close(); } }
public virtual SobaInsertRequest Insert(SobaInsertRequest Model) { return(_sobaService.Insert(Model)); }
public Model.Soba Update(int id, SobaInsertRequest update) { return(_service.Update(id, update)); }
public Model.Soba Insert(SobaInsertRequest insert) { return(_service.Insert(insert)); }