예제 #1
0
        public rValue <int> Delete <T>(pId prms, Bilet ticket, CuteModel db) where T : BaseModel, new()
        {
            var ent = Get <T>(prms.id, db);

            if (ent == null)
            {
                throw Exceptions.NotExist();
            }

            Delete(ent, ticket, db);

            return(new rValue <int>(ent.id));
        }
예제 #2
0
 public rValue <int> Delete(pId prms, Bilet blt)
 {
     using (var db = getDb())
     {
         var trns = db.Database.BeginTransaction();
         try
         {
             var result = this.Delete <DAL.Model.Users, CuteModel>(prms, blt);
             trns.Commit();
             return(result);
         }
         catch (Exception ex)
         {
             trns.Rollback();
             LogYaz(ex, blt);
             throw;
         }
     }
 }
예제 #3
0
        public rValue <int> Delete <T, T2>(pId prms, Bilet ticket) where T : BaseModel, new() where T2 : CuteModel, new()
        {
            using (var db = getDb <T2>())
            {
                var trns = db.Database.BeginTransaction();
                try
                {
                    var result = Delete <T>(prms, ticket, db);

                    trns.Commit();

                    return(result);
                }
                catch (Exception)
                {
                    trns.Rollback();
                    //bllLog.Ekle(IslemSinifi, IslemMetodlari.Ekle, ex, ticket);
                    throw;
                }
            }
        }
예제 #4
0
        public rValue <int> Delete <T, T2>(pIds prms, Bilet ticket) where T : BaseModel, new() where T2 : CuteModel, new()
        {
            using (var db = getDb <T2>())
            {
                var trns = db.Database.BeginTransaction();
                try
                {
                    rValue <int> result = new rValue <int>();

                    if (prms.ids != null && prms.ids.Count > 0)
                    {
                        foreach (var Id in prms.ids)
                        {
                            var parameter = new pId(Id);
                            result = Delete <T>(parameter, ticket, db);
                        }
                    }
                    else if (prms.id.HasValue)
                    {
                        var parameter = new pId(prms.id.Value);
                        result = Delete <T>(parameter, ticket, db);
                    }
                    else
                    {
                        throw Exceptions.Parameter();
                    }

                    trns.Commit();

                    return(result);
                }
                catch (Exception)
                {
                    trns.Rollback();
                    //bllLog.Ekle(IslemSinifi, IslemMetodlari.Ekle, ex, ticket);
                    throw;
                }
            }
        }