Пример #1
0
        ///<summary>
        ///Permite Guardar una entidad en la Base de Datos.
        ///</summary>
        ///<param name="articulo">una instancia de Articulo</param>
        ///<returns>Retorna True si Guardó o False si no lo hizo</returns>
        public static bool Guardar(Cotizaciones cotizaciones)
        {
            bool paso = false;
            //creamos una instancia del contexto para poder conectar con la BD.
            Contexto contexto = new Contexto();

            try
            {
                if (contexto.Cotizaciones.Add(cotizaciones) != null)
                {
                    foreach (var item in cotizaciones.Detalle)
                    {
                        contexto.Articulos.Find(item.ArticulosId).CantCotizada -= item.CantidadCotizada;
                    }
                    contexto.SaveChanges();//Guardar los cambios.
                    paso = true;
                }
                contexto.Dispose();//Siempre hay que cerrar la conexión.
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
Пример #2
0
        ///<summary>
        ///Permite Eliminar una entidad en la Base de Datos.
        ///</summary>
        ///<param name="id">El id el Articulo que desea Eliminar</param>
        ///<returns>Retorna True si Eliminó o False si no lo hizo</returns>
        public static bool Eliminar(int id)
        {
            bool paso = false;
            //creamos una instancia del contexto para poder conectar con la BD.
            Contexto contexto = new Contexto();

            try
            {
                Cotizaciones cotizaciones = contexto.Cotizaciones.Find(id);

                foreach (var item in cotizaciones.Detalle)
                {
                    var articulos = contexto.Articulos.Find(item.ArticulosId);
                    articulos.CantCotizada -= item.CantidadCotizada;
                }
                contexto.Cotizaciones.Remove(cotizaciones);

                if (contexto.SaveChanges() > 0)
                {
                    paso = true;
                }
                contexto.Dispose();//Siempre hay que cerrar la conexión.
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
Пример #3
0
        ///<summary>
        ///Permite Buscar una entidad en la Base de Datos.
        ///</summary>
        ///<param name="id">El id el Articulo que desea encontrarar</param>
        ///<returns>Retorna el Articulo encontrado</returns>
        public static Cotizaciones Buscar(int id)
        {
            //creamos una instancia del contexto para poder conectar con la BD.
            Contexto     contexto     = new Contexto();
            Cotizaciones cotizaciones = new Cotizaciones();

            try
            {
                cotizaciones = contexto.Cotizaciones.Find(id);

                if (cotizaciones != null)
                {
                    //Cargar la lista en este punto porque
                    //luego de hacer Dispose() el Contexto
                    //no sera posible leer la lista
                    cotizaciones.Detalle.Count();
                    //Cargar las Descripcion
                    //Cargar el Nombre Descripcion
                    foreach (var item in cotizaciones.Detalle)
                    {
                        //forzando la Descripcion y Nombres a cargarse
                        string s  = item.Articulos.Descripcion;
                        string ss = item.Personas.Nombres;
                    }
                }
                contexto.Dispose();//Siempre hay que cerrar la conexión.
            }
            catch (Exception)
            {
                throw;
            }
            return(cotizaciones);
        }
Пример #4
0
        private void Modificarbutton_Click(object sender, EventArgs e)
        {
            DAL.Contexto contexto = new DAL.Contexto();

            Cotizaciones cotizacion = new Cotizaciones();

            cotizacion = contexto.Cotizaciones.Find(1);
            contexto.Dispose();//me desconecto aqui

            contexto = new DAL.Contexto();

            cotizacion.AgregarDetalle(1, "Croissant", 2);
            cotizacion.AgregarDetalle(1, "Croissant", 2);
            cotizacion.AgregarDetalle(1, "Croissant", 2);
            cotizacion.AgregarDetalle(1, "Croissant", 2);
            cotizacion.AgregarDetalle(1, "Croissant", 2);

            //recorrer el detalle
            foreach (var item in cotizacion.Detalle)
            {
                item.CotizacionId          = cotizacion.CotizacionId;
                contexto.Entry(item).State = EntityState.Added;
            }

            contexto.SaveChanges();
        }
        public IHttpActionResult PutCotizaciones(int id, Cotizaciones cotizaciones)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cotizaciones.IdCotizacion)
            {
                return(BadRequest());
            }

            db.Entry(cotizaciones).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CotizacionesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #6
0
        private Cotizaciones LlenaClase()
        {
            Cotizaciones cotizacionArticulos = new Cotizaciones();

            cotizacionArticulos.CotizacionId  = Convert.ToInt32(CotizacioIDnumericUpDown.Value);
            cotizacionArticulos.Fecha         = Fecha2dateTimePicker.Value;
            cotizacionArticulos.Observaciones = observacionesTextbox.Text;



            foreach (DataGridViewRow item in DetalleCotizacionesdataGridView.Rows)
            {
                cotizacionArticulos.AgregarDetalle
                    (ToInt(item.Cells["ID"].Value),
                    cotizacionArticulos.CotizacionId,
                    ToInt(item.Cells["PersonaId"].Value),
                    ToInt(item.Cells["ArticuloId"].Value),
                    ToInt(item.Cells["Cantidad"].Value),
                    Convert.ToString(item.Cells["Descripcion"].Value),
                    ToInt(item.Cells["Precio"].Value),
                    ToInt(item.Cells["Importe"].Value)



                    );
            }
            return(cotizacionArticulos);
        }
Пример #7
0
        public static bool Guardar(Cotizaciones cotizacion)
        {
            bool retorno = false;

            try
            {
                using (var db = new EjemploDetalleDb())
                {
                    if (Buscar(cotizacion.CotizacionId) == null)
                    {
                        db.Cotizacion.Add(cotizacion);
                    }
                    else
                    {
                        db.Entry(cotizacion).State = EntityState.Modified;
                    }

                    foreach (var cotizaciones in cotizacion.Detalle)
                    {
                        db.Entry(cotizaciones).State = EntityState.Unchanged;
                    }
                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Пример #8
0
        public async Task <IActionResult> PostCotizaciones([FromBody] Cotizaciones cotizaciones)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Cotizaciones.Add(cotizaciones);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (CotizacionesExists(cotizaciones.CotizacionId))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetCotizaciones", new { id = cotizaciones.CotizacionId }, cotizaciones));
        }
Пример #9
0
        public async Task <IActionResult> PutCotizaciones([FromRoute] int id, [FromBody] Cotizaciones cotizaciones)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != cotizaciones.CotizacionId)
            {
                return(BadRequest());
            }

            _context.Entry(cotizaciones).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CotizacionesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public static bool Modificar(Cotizaciones cotizacion)
        {
            bool paso = false;

            Contexto contexto = new Contexto();

            try
            {
                //recorrer el detalle
                foreach (var item in cotizacion.Detalle)
                {
                    var estado = item.Id > 0 ? EntityState.Modified : EntityState.Added;
                    contexto.Entry(item).State = estado;
                }

                //Idicar que se esta modificando el encabezado
                contexto.Entry(cotizacion).State = EntityState.Modified;

                if (contexto.SaveChanges() > 0)
                {
                    paso = true;
                }
                contexto.Dispose();
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
Пример #11
0
        public static bool Modificar(Cotizaciones Cotizacion)
        {
            bool paso = false;

            Contexto contexto = new Contexto();

            try
            {
                foreach (var item in Cotizacion.Detalle)
                {
                    var estado = item.Id > 0 ? EntityState.Modified : EntityState.Added;
                    contexto.Entry(item).State = estado;
                }


                contexto.Entry(Cotizacion).State = EntityState.Modified;

                if (contexto.SaveChanges() > 0)
                {
                    paso = true;
                }
                contexto.Dispose();
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
Пример #12
0
        public string Post(Cotizaciones cotizaciones)
        {
            try
            {
                DataTable table = new DataTable();
                DateTime  time  = cotizaciones.FechaDeExpedicion;
                DateTime  time2 = cotizaciones.Vigencia;

                string format = "yyyy-MM-dd HH:mm:ss";



                string query = @" Execute itInsertNuevaCotizacion " + cotizaciones.IdCliente + " , '" + cotizaciones.Nombre + "' , '" + cotizaciones.RFC + "' , '" + cotizaciones.Subtotal + "' , '" + cotizaciones.Total + "' , '" + cotizaciones.Descuento + "' , '"
                               + cotizaciones.SubtotalDlls + "' , '" + cotizaciones.TotalDlls + "' , '" + cotizaciones.DescuentoDlls + "' , '" + cotizaciones.Observaciones + "' , '" + cotizaciones.Vendedor + "' , '" + cotizaciones.Moneda + "' , '" + time.ToLocalTime().ToString(format) +
                               "' , '" + cotizaciones.Flete + "' , " + cotizaciones.Folio + " , '" + cotizaciones.Telefono + "' , '" + cotizaciones.Correo + "' , " + cotizaciones.IdDireccion + " , '" + cotizaciones.Estatus + "' , " + cotizaciones.TipoDeCambio + " , '" + time2.ToLocalTime().ToString(format) + "' ";

                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }



                return("Cotizacion Agregada");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("IDCotizacion,IDMoneda,Fecha,Cotizacion")] Cotizaciones cotizaciones)
        {
            if (id != cotizaciones.IDCotizacion)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cotizaciones);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CotizacionesExists(cotizaciones.IDCotizacion))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IDMoneda"] = new SelectList(_context.Monedas.OrderBy(m => m.Sigla), "IDMoneda", "Sigla", cotizaciones.IDMoneda);
            return(View(cotizaciones));
        }
Пример #14
0
        public static bool Insertar(Cotizaciones a)
        {
            bool retornar = false;

            using (var db = new FSVentasDb())
            {
                try
                {
                    if (Buscar(a.CotizacionId) == null)
                    {
                        db.Cotizaciones.Add(a);
                    }
                    else
                    {
                        db.Entry(a).State = EntityState.Modified;
                    }
                    db.SaveChanges();

                    retornar = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retornar);
            }
        }
        public String saveCotizaciones(String cotizaciones)
        {
            IList <Cotizaciones> cotizacionesList = JsonConvert.DeserializeObject <List <Cotizaciones> >(cotizaciones);

            if (cotizacionesList.Count > 0)
            {
                int     polizaId       = Convert.ToInt32(cotizacionesList[0].polizaId);
                int     clienteId      = Convert.ToInt32(cotizacionesList[0].clienteId);
                decimal impuestos      = Convert.ToDecimal(cotizacionesList[0].impuestos);
                int     cantidadCuotas = Convert.ToInt32(cotizacionesList[0].cantidadCuotas);
                int     aseguradoraId  = 1;
                // TODO: Aseguradora unhardcode

                // 1 - Update Poliza
                string query = "Update Poliza Set Estado = '" + "Cotizada"
                               + "', CantidadCuotas = " + cantidadCuotas
                               + ", Impuestos = " + impuestos
                               + " WHERE Id = '" + polizaId + "'";
                DataUtils.DML(query);
                // TODO: Agente Id

                // 2 - Insert EspecialidadesCubiertas
                List <EspecialidadCliente> listEspecialidades = DataUtils.getEspecialidadesCliente(clienteId);
                for (int i = 0; i < listEspecialidades.Count; i++)
                {
                    int espCubiertaId = DataUtils.getId("EspecialidadesCubiertas");
                    // TODO: Mayor riesgo
                    DataUtils.DML("Insert into EspecialidadesCubiertas (Id, Especialidad, MayorRiesgo, Poliza) values (" + espCubiertaId + ",'" + listEspecialidades[i].Id + "','" + false + "','" + polizaId + "')");
                }

                // 3 - Insert OpcionesCotizacion
                // TBD: Riesgo financiero?
                for (int i = 0; i < cotizacionesList.Count; i++)
                {
                    Cotizaciones cotizacion         = cotizacionesList[i];
                    decimal      recargo            = Math.Round(Convert.ToDecimal(cotizacion.recargaPrima) / 100, 2);
                    decimal      comision           = Math.Round(Convert.ToDecimal(cotizacion.comisionPrimaPercent) / 100, 2);
                    int          opcionCotizacionId = DataUtils.getId("OpcionesCotizacion");
                    DataUtils.DML("Insert into OpcionesCotizacion (Id, Poliza, PrimaBase, SumaAsegurada, [RecargoPrima%], ComisionPrima, PrimaPoliza, PremioTotal, PremioCuota, Condicion, Aseguradora, OpcionElegida) values (" +
                                  opcionCotizacionId
                                  + "," + polizaId
                                  + "," + Convert.ToDecimal(cotizacion.primaBase)
                                  + "," + Convert.ToDecimal(cotizacion.sumaAsegurada)
                                  + "," + recargo
                                  + "," + comision
                                  + "," + Convert.ToDecimal(cotizacion.primaPoliza)
                                  + "," + Convert.ToDecimal(cotizacion.premioTotal)
                                  + "," + Convert.ToDecimal(cotizacion.premioCuota)
                                  + ",'" + cotizacion.condicion + "'," + aseguradoraId + ",'" + false + "')");
                }

                return("Operacion Exitosa");
            }
            else
            {
                return("Error");
            }

            //return View(_context.Poliza);
        }
Пример #16
0
        public static Cotizaciones Buscar(int id)
        {
            Cotizaciones cotizacion = new Cotizaciones();
            Contexto     contexto   = new Contexto();

            try
            {
                cotizacion = contexto.Cotizaciones.Find(id);
                cotizacion.Detalle.Count();


                foreach (var item in cotizacion.Detalle)
                {
                    string s = item.Articulos.Descripcion;
                    string r = item.Personas.Nombres;
                }
                contexto.Dispose();
            }

            catch (Exception)
            {
                throw;
            }

            return(cotizacion);
        }
Пример #17
0
        public float Cotizar(Prenda prenda, float precio, int cantidad)
        {
            if (prenda == null)
            {
                throw new Exception("No existe la prenda");
            }
            if (precio <= 0)
            {
                throw new Exception("Precio Invalido");
            }
            if (cantidad <= 0)
            {
                throw new Exception("Cantidad invalida");
            }
            if (cantidad > GetStockPrenda(prenda))
            {
                throw new Exception("No hay stock suficiente");
            }

            foreach (Descuento descuento in descuentos)
            {
                if (descuento.Regla(prenda))
                {
                    precio = precio - precio * descuento.Porcentaje / 100;
                }
            }

            precio *= cantidad;

            Cotizaciones.Add(new Cotizacion(NuevoCodigoCotizacion(), System.DateTime.Now, VendedorActual, prenda, precio, cantidad));

            return(precio);
        }
Пример #18
0
        public static bool Modificar(Cotizaciones cotizacion)
        {
            bool paso = false;

            Contexto contexto = new Contexto();

            try
            {
                //todo: buscar las entidades que no estan para removerlas

                //recorrer el detalle
                foreach (var item in cotizacion.Detalle)
                {
                    //Muy importante indicar que pasara con la entidad del detalle
                    var estado = item.Id > 0 ? EntityState.Modified : EntityState.Added;
                    contexto.Entry(item).State = estado;
                }

                //Idicar que se esta modificando el encabezado
                contexto.Entry(cotizacion).State = EntityState.Modified;

                if (contexto.SaveChanges() > 0)
                {
                    paso = true;
                }
                contexto.Dispose();
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
Пример #19
0
        public static bool Eliminar(int id)
        {
            bool paso = false;

            Contexto contexto = new Contexto();

            try
            {
                Cotizaciones cotizacion = contexto.Cotizaciones.Find(id);
                contexto.Cotizaciones.Remove(cotizacion);
                if (contexto.SaveChanges() > 0)
                {
                    paso = true;
                }

                contexto.Dispose();
            }

            catch (Exception)
            {
                throw;
            }

            return(paso);
        }
Пример #20
0
        public static bool Guardar(Cotizaciones cotizacion)
        {
            bool paso = false;

            Contexto contexto = new Contexto();

            try
            {
                if (contexto.Cotizaciones.Add(cotizacion) != null)
                {
                    foreach (var item in cotizacion.Detalle)
                    {
                        contexto.Articulos.Find(item.ArticuloId).CantidadCotizada -= item.Cantidad;
                    }

                    contexto.SaveChanges();
                    paso = true;
                }

                contexto.Dispose();
            }
            catch (Exception)
            {
                throw;
            }
            return(paso);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Cotizaciones cotizaciones = BLL.CotizacionesBLL.Buscar(id);

            BLL.CotizacionesBLL.Eliminar(cotizaciones);
            return(RedirectToAction("Index"));
        }
Пример #22
0
        public async Task <IActionResult> Edit(int id, [Bind("CotizacionId,ClienteId,Articulo,Fecha,Cantidad,Monto")] Cotizaciones cotizaciones)
        {
            if (id != cotizaciones.CotizacionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cotizaciones);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CotizacionesExists(cotizaciones.CotizacionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(cotizaciones));
        }
Пример #23
0
        public static Cotizaciones Buscar(int id)
        {
            Cotizaciones cotizacion = new Cotizaciones();
            Contexto     contexto   = new Contexto();

            try
            {
                cotizacion = contexto.Cotizaciones.Find(id);
                //Cargar la lista en este punto porque
                //luego de hacer Dispose() el Contexto
                //no sera posible leer la lista
                cotizacion.Detalle.Count();

                //Cargar los nombres de las personas y articulos
                foreach (var item in cotizacion.Detalle)
                {
                    //forzando la persona y el articulo a cargarse
                    string s = item.Articulos.Descripcion;
                    string r = item.Personas.Nombres;
                }
                contexto.Dispose();
            }

            catch (Exception)
            {
                throw;
            }

            return(cotizacion);
        }
Пример #24
0
 public ActionResult Cotizacion(int[] Producto, int[] Cantidad, int[] Cliente)
 {
     // El arreglo de producto contiene los productos para realizar la salida de inventario
     if (Producto.Length > 0)
     {
         Cotizaciones cotizacion = new Cotizaciones();
         int          cont       = 0;
         foreach (int p in Producto)
         {
             cotizacion = new Cotizaciones();
             // Calcula el nuevo IdSalida del registro
             cotizacion.IdCotizacion = 1;
             if (ListaCotizaciones.Count > 0)
             {
                 cotizacion.IdCotizacion = ListaCotizaciones.Max(x => x.IdCotizacion) + 1;
             }
             // Establecemos las demas propiedades del modelo
             cotizacion.IdProducto       = p;
             cotizacion.NumeroCotizacion = cotizacion.IdCotizacion;
             cotizacion.Cantidad         = Cantidad[cont];
             cotizacion.Producto         = ListaProducto.FirstOrDefault(x => x.IdProducto == p);
             cotizacion.Subtotal         = cotizacion.Cantidad * cotizacion.Producto.Precio * 1;
             cotizacion.FechaRegistro    = DateTime.Now;
             cotizacion.IdCliente        = Cliente[cont]; // Este valor se debe de tomar de la variable de Session["Usuario"]
             ListaCotizaciones.Add(cotizacion);           // Agregamos el producto a la lista de salidas
             cont++;                                      // Incrementa contador
             cotizacion = null;                           // Limpia el modelo para el siguiente ciclo
         }
         // db.Guardar(ListaCotizaciones);
         // Esta vista muestra los registros del modelo SalidaInventario con una plantilla de tipo List
         return(RedirectToAction("Reporte"));
     }
     return(View());
 }
Пример #25
0
        public void InsertQuotation(Quotation quotation)
        {
            Cotizaciones mappedEntity = iMapper.Map <Quotation, Cotizaciones>(quotation);

            mappedEntity.FechaVencimiento = DateTime.Today.AddYears(1);
            Add(mappedEntity);
        }
Пример #26
0
        public JsonResult Eliminar(Cotizaciones cotizacion)
        {
            int id     = cotizacion.CotizacionId;
            var cot    = BLL.CotizacionesBLL.Buscar(id);
            var result = 0;

            if (cot != null)
            {
                if (BLL.CotizacionesBLL.Eliminar(cot))
                {
                    if (BLL.DetalleCotizacionesBLL.Eliminar(BLL.DetalleCotizacionesBLL.Listar(id)))
                    {
                        result = 1;
                    }
                }
                else
                {
                    result = 0;
                }
            }
            else
            {
                result = 0;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #27
0
        public static bool Guardar(Cotizaciones cotizaciones, Cotizaciones_detalles[] cotizaciones_Detalles)
        {
            bool estado = false;

            try
            {   //guardando cotizacion
                Context context = new Context();
                context.cotizacion.Add(cotizaciones);
                context.SaveChanges();
                int id = cotizaciones.CotizacionesId;

                //guardando detalles de cotizacion
                foreach (Cotizaciones_detalles datos in cotizaciones_Detalles)
                {
                    Cotizaciones_detalles cd = new Cotizaciones_detalles();
                    cd.CotizacionesId = id;
                    cd.ArticuloId     = datos.ArticuloId;
                    cd.Cantidad       = datos.Cantidad;
                    cd.Precio         = datos.Precio;
                    cd.Total          = datos.Total;
                    context.cotizacion_detalles.Add(cd);
                    context.SaveChanges();
                }


                estado = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(estado);
        }
Пример #28
0
        public static bool Eliminar(int id)
        {
            bool paso = false;

            Contexto contexto = new Contexto();

            try
            {
                Cotizaciones cotizacion = contexto.Cotizaciones.Find(id);

                foreach (var item in cotizacion.Detalle)
                {
                    var ciudad = contexto.Articulos.Find(item.ArticuloId);
                    ciudad.CantidadCotizada += item.Cantidad;
                }

                contexto.Cotizaciones.Remove(cotizacion);
                if (contexto.SaveChanges() > 0)
                {
                    paso = true;
                }

                contexto.Dispose();
            }

            catch (Exception)
            {
                throw;
            }

            return(paso);
        }
Пример #29
0
        public ActionResult DeleteConfirmed(int id)
        {
            Cotizaciones cotizaciones = db.Cotizaciones.Find(id);

            db.Cotizaciones.Remove(cotizaciones);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <Cotizaciones> save(Cotizaciones model)
        {
            await _context.Cotizaciones.AddAsync(model);

            await _context.SaveChangesAsync();

            return(model);
        }