Beispiel #1
0
        public ActionResult Create(Lote model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.AsignarId();

                    model.Estado      = Rp3.AgendaComercial.Models.Constantes.Estado.Activo;
                    model.EstadoTabla = Rp3.AgendaComercial.Models.Constantes.Estado.Tabla;
                    model.UsrIng      = this.UserLogonName;
                    model.FecIng      = this.GetCurrentDateTime();

                    model.LoteDetalles = new List <LoteDetalle>();

                    SetResumen(model);

                    DataBase.Lotes.Insert(model);
                    DataBase.Save();

                    DataBase.Lote.ProcesarLote(model);
                    DataBase.Save();

                    this.AddDefaultSuccessMessage();
                    return(RedirectToAction("Index", model));
                }
            }
            catch
            {
                this.AddDefaultErrorMessage();
            }
            InicializarEdit();
            model.LoteDetalles = new List <LoteDetalle>();
            return(View(model));
        }