コード例 #1
0
        public void Create(BustoIslaidosViewModel bustoIslaidos)
        {
            var entity = new BustoIslaidos();

            entity.MetaiId = bustoIslaidos.Metai.Id;
            if (entity.MetaiId == null)
            {
                entity.MetaiId = 1;
            }

            if (bustoIslaidos.Metai == null)
            {
                entity.MetaiId = bustoIslaidos.Metai.Id;
            }
            entity.MenuoId = bustoIslaidos.Menesiai.Id;
            entity.SavaiteId = bustoIslaidos.Savaites.Id;
            entity.DienaId = bustoIslaidos.Dienos.Id;
            entity.Data = bustoIslaidos.Data;
            entity.Paskola = bustoIslaidos.Paskola;
            entity.MalgozatosTelefonas = bustoIslaidos.MalgozatosTelefonas;
            entity.JuliausTelefonas = bustoIslaidos.JuliausTelefonas;
            entity.Elektra = bustoIslaidos.Elektra;
            entity.Vanduo = bustoIslaidos.Vanduo;
            entity.Šildymas = bustoIslaidos.Šildymas;
            entity.TvIrInterntetas = bustoIslaidos.TvIrInterntetas;
            entity.BendriMokesciai = bustoIslaidos.BendriMokesciai;
            entity.Kita = bustoIslaidos.Kita;

            entities.BustoIslaidos.Add(entity);
            entities.SaveChanges();

            bustoIslaidos.Id = entity.Id;
        }
コード例 #2
0
        public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, BustoIslaidosViewModel product)
        {
            if (product != null)
            {
                bustoIslaidosService.Destroy(product);
            }

            return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }
コード例 #3
0
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, BustoIslaidosViewModel product)
        {
            if (product != null && ModelState.IsValid)
            {
                bustoIslaidosService.Create(product);
            }

            return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }
コード例 #4
0
        public void Destroy(BustoIslaidosViewModel bustoIslaidos)
        {
            var entity = new BustoIslaidos();

            entity.Id = bustoIslaidos.Id;
            entities.BustoIslaidos.Attach(entity);
            entities.BustoIslaidos.Remove(entity);
            entities.SaveChanges();
        }