Esempio n. 1
0
        public ActionResult Create(БанкАдрес model)
        {
            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            bankRepository.saveBank(model.банк);
            return(Redirect("/Bank/Show"));
        }
Esempio n. 2
0
        public ActionResult Update(БанкАдрес model)
        {
            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            model.банк.ИД_Адреса = model.адрес.ИД_Адреса;
            bankRepository.update(model);
            return(Redirect("/Bank/Show"));
        }
Esempio n. 3
0
        public ActionResult Update(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Банк      банк      = bankRepository.findBankById(id.Value);
            БанкАдрес банкАдрес = new БанкАдрес();

            банкАдрес.банк  = банк;
            банкАдрес.адрес = банк.Адрес;
            return(View(банкАдрес));
        }
Esempio n. 4
0
        public void update(БанкАдрес банкАдрес)
        {
            dBModel.Entry(банкАдрес.адрес).State = EntityState.Modified;
            dBModel.Entry(банкАдрес.банк).State  = EntityState.Modified;

            try
            {
                dBModel.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                foreach (DbEntityValidationResult validationError in ex.EntityValidationErrors)
                {
                    Trace.Write("Object: " + validationError.Entry.Entity.ToString());
                    Trace.Write("");
                    foreach (DbValidationError err in validationError.ValidationErrors)
                    {
                        Trace.Write(err.ErrorMessage + "");
                    }
                }
            }
        }
Esempio n. 5
0
        public ActionResult Create()
        {
            БанкАдрес банкАдрес = new БанкАдрес();

            return(View(банкАдрес));
        }