示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
 public SobaInsertRequest Insert(SobaInsertRequest model)
 {
     if (model.SobaId == 0)
     {
         Soba s = _mapper.Map <Soba>(model);
         _context.Soba.Add(s);
         _context.SaveChanges();
     }
     return(model);
 }
示例#4
0
        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);
            }
        }
示例#5
0
        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();
            }
        }
示例#6
0
 public virtual SobaInsertRequest Insert(SobaInsertRequest Model)
 {
     return(_sobaService.Insert(Model));
 }
示例#7
0
 public Model.Soba Update(int id, SobaInsertRequest update)
 {
     return(_service.Update(id, update));
 }
示例#8
0
 public Model.Soba Insert(SobaInsertRequest insert)
 {
     return(_service.Insert(insert));
 }