public void ActualizarPerfil() { //var rm = new ResponseModel(); try { using (var dbwanlla = new db_wanlla()) { //dbwanlla.Configuration.ValidateOnSaveEnabled = false; //var eUsuario = dbwanlla.Entry(this); dbwanlla.Entry(this).Property(x => x.id_usuario).IsModified = false; //if (this.nom_usuario == null) eUsuario.Property(x => x.nom_usuario).IsModified = false; dbwanlla.Entry(this).Property(x => x.pass_usuario).IsModified = false; dbwanlla.Entry(this).State = EntityState.Modified; //Obviar campos o ignorar en la actualización dbwanlla.SaveChanges(); //rm.SetResponse(true); } } //catch (DbEntityValidationException e) //{ // throw; //} catch (Exception) { throw; } }
public void Guardar() { using (var db = new db_wanlla()) { db.Entry(this).State = EntityState.Added; db.SaveChanges(); } }
public void Guardar() { try { using (var dbwanlla = new db_wanlla()) { if (this.id_distribuidor > 0) { dbwanlla.Entry(this).State = EntityState.Modified; } else { dbwanlla.Entry(this).State = EntityState.Added; } dbwanlla.SaveChanges(); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Manteniemiento (Agregar, Modificar) Dieta /// </summary> public void mantenimiento() { try { using (var db = new db_wanlla()) { if (this.id_dieta > 0) { db.Entry(this).State = EntityState.Modified; } else { db.Entry(this).State = EntityState.Added; } db.SaveChanges(); } } catch (Exception ex) { throw; } }
public void Eliminar() { try { using (var dbwanlla = new db_wanlla()) { dbwanlla.Entry(this).State = EntityState.Deleted; dbwanlla.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void actualizar() { try { using (var db = new db_wanlla()) { db.Entry(this).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void guardar() { try { using (var db = new db_wanlla()) { db.Entry(this).State = EntityState.Added; db.SaveChanges(); } } catch (Exception ex) { throw; } }
public void eliminar() { try { using (var db = new db_wanlla()) { db.Entry(this).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); } } catch (Exception ex) { throw; } }
public void confirmarPedido() { try { using (var db = new db_wanlla()) { this.est_pedido = "Confirmado"; db.Entry(this).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public void registrar() { try { using (var db = new db_wanlla()) { this.pass_usuario = BCrypt.Net.BCrypt.HashPassword(this.pass_usuario, BCrypt.Net.BCrypt.GenerateSalt()); db.Entry(this).State = EntityState.Added; db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public ResponseModel eliminar() { var rm = new ResponseModel(); try { using (var db = new db_wanlla()) { db.Entry(this).State = EntityState.Deleted; rm.SetResponse(true); db.SaveChanges(); } } catch (Exception ex) { throw ex; } return(rm); }
/// <summary> /// Cambiar password del Usuario /// </summary> public void cambiarPassword(string new_pass, int id_usuario) { try { using (var db = new db_wanlla()) { var usu = db.usuario .Where(x => x.id_usuario == id_usuario) .SingleOrDefault(); usu.pass_usuario = BCrypt.Net.BCrypt.HashPassword(new_pass, BCrypt.Net.BCrypt.GenerateSalt()); db.Entry(usu).State = EntityState.Modified; db.SaveChanges(); } } catch (Exception ex) { throw ex; } }
public ResponseModel Guardar(HttpPostedFileBase Foto) { var rm = new ResponseModel(); try { using (var db = new db_wanlla()) { db.Configuration.ValidateOnSaveEnabled = false; var eCategoria = db.Entry(this); if (this.id_categoria > 0) { eCategoria.State = EntityState.Modified; if (Foto != null) { String archivo = Path.GetFileName(Foto.FileName); //*Path.GetExtension(Foto.FileName); //String archivo = DateTime.Now.ToString("yyyyMMddMMss") + Path.GetFileName(Foto.FileName); Foto.SaveAs(HttpContext.Current.Server.MapPath("~/images/" + archivo)); this.img_categoria = archivo; } else { eCategoria.Property(x => x.img_categoria).IsModified = false; } db.SaveChanges(); rm.SetResponse(true); } else { eCategoria.State = EntityState.Added; if (Foto != null) { String archivo = Path.GetFileName(Foto.FileName); //*Path.GetExtension(Foto.FileName); //String archivo = DateTime.Now.ToString("yyyyMMddMMss") + Path.GetFileName(Foto.FileName); Foto.SaveAs(HttpContext.Current.Server.MapPath("~/images/" + archivo)); this.img_categoria = archivo; } else { eCategoria.Property(x => x.img_categoria).IsModified = false; } db.SaveChanges(); rm.SetResponse(true); } } } catch (DbEntityValidationException e) { throw; } catch (Exception) { throw; } return(rm); }