コード例 #1
0
        public BaseApiResponse UpdateCourt(CourtEntity model)
        {
            var response = new BaseApiResponse();

            try
            {
                SqlParameter[] param = { new SqlParameter("CourtID", (object)model.CourtID ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("CourtType", (object)model.CourtType ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("StateID", (object)model.StateID ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("DistrictID", (object)model.DistrictID ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("CountyID", (object)model.CountyID ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("CourtName", (object)model.CourtName ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("IsActive", (object)model.IsActive ?? (object)DBNull.Value)
                                         ,                           new SqlParameter("UpdatedBy", (object)model.UpdatedBy ?? (object)DBNull.Value) };
                var            result = _repository.ExecuteSQL <int>("UpdateCourt", param).FirstOrDefault();
                if (result > 0)
                {
                    response.Success = true;
                }
            }
            catch (Exception ex)
            {
                response.Message.Add(ex.Message);
            }

            return(response);
        }
コード例 #2
0
        public void Add(string name)
        {
            CourtEntity court = new CourtEntity()
            {
                Name = name
            };

            _context.Courts.Add(court);
            _context.SaveChanges();
        }
コード例 #3
0
        public bool UpdateCourt(CourtEntity courtEntity)
        {
            bool result = false;

            Database  db        = DatabaseFactory.CreateDatabase(Constant.DiaryDBConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("usp_CourtUpdate");

            db.AddInParameter(dbCommand, "@CourtId", DbType.Guid, courtEntity.CourtId);
            db.AddInParameter(dbCommand, "@Court", DbType.String, courtEntity.Court);
            db.AddInParameter(dbCommand, "@CourtTypeId", DbType.Guid, courtEntity.CourtTypeId);
            db.AddInParameter(dbCommand, "@PoliceStation", DbType.String, courtEntity.PoliceStation);
            db.AddInParameter(dbCommand, "@UpdatedBy", DbType.Guid, courtEntity.UpdatedBy);

            db.ExecuteNonQuery(dbCommand);

            result = true;

            return(result);
        }
コード例 #4
0
        public Guid InsertCourt(CourtEntity courtEntity)
        {
            Guid result;

            Database  db        = DatabaseFactory.CreateDatabase(Constant.DiaryDBConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("usp_CourtInsert");

            db.AddInParameter(dbCommand, "@Court", DbType.String, courtEntity.Court);
            db.AddInParameter(dbCommand, "@CourtTypeId", DbType.Guid, courtEntity.CourtTypeId);
            db.AddInParameter(dbCommand, "@PoliceStation", DbType.String, courtEntity.PoliceStation);

            db.AddInParameter(dbCommand, "@CreatedBy", DbType.Guid, courtEntity.CreatedBy);

            db.AddOutParameter(dbCommand, "@CourtId", DbType.Guid, 30);

            db.ExecuteNonQuery(dbCommand);

            result = new Guid(db.GetParameterValue(dbCommand, "@CourtId").ToString());

            return(result);
        }
コード例 #5
0
ファイル: Court.cs プロジェクト: VijayMVC/DairyManager
 public bool UpdateCourt(CourtEntity courtEntity)
 {
     return(courtDao.UpdateCourt(courtEntity));
 }
コード例 #6
0
ファイル: Court.cs プロジェクト: VijayMVC/DairyManager
 public Guid InsertCourt(CourtEntity courtEntity)
 {
     return(courtDao.InsertCourt(courtEntity));
 }