/// <summary> /// /// </summary> /// <param name="Mercante"></param> /// <param name="Cliente"></param> /// <returns></returns> public static int UnFollowMercante(int Mercante, int Cliente) { try { using (MsSqlFacade<ClientesMercantes, ClientesMercantesMapper> facade = new MsSqlFacade<ClientesMercantes, ClientesMercantesMapper>()) { /// client facade read from the list ClientesMercantes entity = facade.Read().Single(p => p.Cliente == Cliente && p.Mercante == Mercante); /// we now check if the entity is null if (entity != null) { /// if is null we deleted form the merchant list of followers return facade.Delete(entity.ID); } else { /// we return a -1 if error return -1; } } } catch { /// in case that fails, we give an empty list return -1; } }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public static int Delete(int id) { using (MsSqlFacade<Promociones, PromocionesMapper> facade = new MsSqlFacade<Promociones, PromocionesMapper>()) { //// we use the Collection to build the broker entity on an abstract phase to manage it as a all return facade.Delete(id); } }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public static int DeleteClientesMercantes(int id) { try { using (MsSqlFacade<ClientesMercantes, ClientesMercantesMapper> facade = new MsSqlFacade<ClientesMercantes, ClientesMercantesMapper>()) { //// we select all the promotion that are active first return facade.Delete(id); } } catch { /// in case that fails, we give an empty list return -1; } }