예제 #1
0
        public int Insert(ProfileImageAddRequest model)
        {
            //Models.IUserAuthData currentUser = _principal.Identity.GetCurrentUser();
            int id = 0;

            this.DataProvider.ExecuteNonQuery(
                "PersonImage_Insert",
                inputParamMapper : delegate(SqlParameterCollection paramCol)
            {
                SqlParameter parm  = new SqlParameter();
                parm.ParameterName = "@Id";
                parm.SqlDbType     = System.Data.SqlDbType.Int;
                parm.Direction     = System.Data.ParameterDirection.Output;
                paramCol.Add(parm);
                paramCol.AddWithValue("@UserId", model.UserId);
                paramCol.AddWithValue("@FileTypeId", model.FileTypeId);
                paramCol.AddWithValue("@UserFileName", model.UserFileName);
                paramCol.AddWithValue("@SystemFileName", model.SystemFileName);
                paramCol.AddWithValue("@Location", model.Location);
                paramCol.AddWithValue("@CreatedBy", model.CreatedBy);
            },
                returnParameters : delegate(SqlParameterCollection paramCol)
            {
                id = (int)paramCol["@Id"].Value;
            }
                );
            return(id);
        }
 public HttpResponseMessage ProfileImageInsert(ProfileImageAddRequest model)
 {
     try
     {
         int Id = _profileDataService.InsertProfileImage(model);
         ItemResponse <int> resp = new ItemResponse <int>();
         resp.Item = Id;
         log.Info("ProfileData Insert ProfileImage Success");
         return(Request.CreateResponse(HttpStatusCode.OK, resp));
     }
     catch (Exception ex)
     {
         log.Error("ProfileData Insert ProfileImage Error", ex);
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
        public int InsertProfileImage(ProfileImageAddRequest model)
        {
            int UserId = 0;

            _dataProvider.ExecuteNonQuery(
                "ProfileImage_Insert",
                inputParamMapper : delegate(SqlParameterCollection paramList)
            {
                paramList.AddWithValue("@UserId", model.UserId);
                paramList.AddWithValue("@FileStorageId", model.FileStorageId);
            },
                returnParameters : delegate(SqlParameterCollection paramList)
            {
                UserId = (int)paramList["@UserId"].Value;
            });
            return(UserId);
        }