public List <ConcernDomain> SelectAll()
        {
            var result = new List <ConcernDomain>();

            _dataProvider.ExecuteCmd(
                "concern_select_all",
                inputParamMapper : null,
                singleRecordMapper : delegate(IDataReader reader, short set)
            {
                ConcernDomain model      = new ConcernDomain();
                int index                = 0;
                model.Id                 = reader.GetSafeInt32(index++);
                model.FileReference      = reader.GetSafeString(index++);
                model.ConcernTitle       = reader.GetSafeString(index++);
                model.ConcernDescription = reader.GetSafeString(index++);
                model.ConcernLevel       = reader.GetSafeInt32(index++);
                model.Status             = reader.GetSafeString(index++);
                model.Address            = reader.GetSafeString(index++);
                model.City               = reader.GetSafeString(index++);
                model.State              = reader.GetSafeString(index++);
                model.Zip                = reader.GetSafeString(index++);
                model.Longitude          = reader.GetSafeString(index++);
                model.Latitude           = reader.GetSafeString(index++);
                model.CreatedDate        = reader.GetSafeDateTime(index++);
                model.DepartmentName     = reader.GetSafeString(index++);
                result.Add(model);
            }
                );
            return(result);
        }
        public ConcernDomain SelectById(int id)
        {
            ConcernDomain model = new ConcernDomain();

            _dataProvider.ExecuteCmd(
                "concern_select_by_id",
                inputParamMapper : delegate(SqlParameterCollection paramCol)
            {
                paramCol.AddWithValue("@Id", id);
            },
                singleRecordMapper : delegate(IDataReader reader, short set)
            {
                int index                = 0;
                model.Id                 = reader.GetSafeInt32(index++);
                model.FileReference      = reader.GetSafeString(index++);
                model.ConcernTitle       = reader.GetSafeString(index++);
                model.ConcernDescription = reader.GetSafeString(index++);
                model.ConcernLevel       = reader.GetSafeInt32(index++);
                model.Status             = reader.GetSafeString(index++);
                model.Address            = reader.GetSafeString(index++);
                model.City               = reader.GetSafeString(index++);
                model.State              = reader.GetSafeString(index++);
                model.Zip                = reader.GetSafeString(index++);
                model.Longitude          = reader.GetSafeString(index++);
                model.Latitude           = reader.GetSafeString(index++);
                model.CreatedDate        = reader.GetSafeDateTime(index++);
                model.DepartmentName     = reader.GetSafeString(index++);
            }
                );
            return(model);
        }
Пример #3
0
 public HttpResponseMessage Update(ConcernDomain model)
 {
     if (ModelState.IsValid)
     {
         SuccessResponse resp = new SuccessResponse();
         _concernService.Update(model);
         return(Request.CreateResponse(HttpStatusCode.OK, resp));
     }
     else
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
 }
 public void Update(ConcernDomain model)
 {
     _dataProvider.ExecuteNonQuery(
         "concern_update",
         inputParamMapper : delegate(SqlParameterCollection paramCol)
     {
         paramCol.AddWithValue("@Id", model.Id);
         paramCol.AddWithValue("@CityDepartment", model.CityDepartment);
         paramCol.AddWithValue("@ConcernTitle", model.ConcernTitle);
         paramCol.AddWithValue("@ConcernDescription", model.ConcernDescription);
         paramCol.AddWithValue("@ConcernLevel", model.ConcernLevel);
         paramCol.AddWithValue("@Status", model.Status);
         paramCol.AddWithValue("@Address", model.Address);
         paramCol.AddWithValue("@City", model.City);
         paramCol.AddWithValue("@State", model.State);
         paramCol.AddWithValue("@Zip", model.Zip);
         paramCol.AddWithValue("@Longitude", model.Longitude);
         paramCol.AddWithValue("@Latitude", model.Latitude);
     }
         );
 }